Discussion:
Simulink Data Logging (To Workspace)
(too old to reply)
J. Andrew Harriman
2010-11-11 22:51:03 UTC
Permalink
Hi,

I have created my own custom data logging block which uses the Simulink "To Workspace" block to record data to a variable in the Matlab workspace. When I specify the name of the variable to record to directly in the "To Workspace" block, everything works as expected.

I would like to use this block several times, so I added a mask to it with a parameter to enter the name of the workspace variable to log the data to. I called the mask parameter "variableName", and I modifed the "To Workspace" block variable name parameter to "variableName". What I am finding is that my data is being logged in the Matlab workspace as the variable "variableName" instead of whatever string I enter in the mask dialog!

It seems like it isn't using the mask variable "variableName", but rather is just literally using the string "variableName".

Any help would be greatly appreciated.


Andy
J. Andrew Harriman
2010-11-12 19:23:09 UTC
Permalink
Ok, I figured this issue out. In case anyone else has the same problem, the solution is as follows:

The "To Workspace" block does not evaluate the variable name input. In order to get it to work, the mask initialization code needs to be modified to update the "To Workspace" block dialog setting. This can be accomplished by:

set_param([gcb '/To Workspace'],'VariableName', variableName)

Where "variableName" is the name of the mask variable.

Thanks to Martin at MathWorks support for his help on this issue.


Andy

Loading...