I'd like to export data generated in Simulink to the Matlab workspace by using a Matlab function that writes the data to a variable in the workspace. Not very efficient, but necessary for my purposes. The problem is that the value passed into the Matlab Fcn block is sometimes incorrect, even wildly inaccurate. I placed a display block in parallel with the Matlab Fcn block and, occasionally, the displayed value does not match the value inside the function code (observed while debugging). Any clues to why this is happening?
Alternatively, is there a way to use a variable inside a structure as the target of the Simulink To Workspace block? Simulink won't allow the "structure.field" syntax as the To Workspace variable name.
Thanks!