Why does ASSIGNIN assign a value in the MATLAB base workspace rather than mask workspace when setting a value within the mask initialization callback in Simulink 7.0 (R2007b)?
5 views (last 30 days)
Show older comments
My model example.mdl contains a masked subsystem. The mask initialization for this subsystem makes a call to a custom MATLAB function in which I use ASSIGNIN to set the value of a parameter in the 'caller' workspace. I expect that the 'caller' workspace is the mask workspace. However, when I run the model and then execute WHOS at the MATLAB command prompt, I find that the variable is assigned in the MATLAB base workspace.
Accepted Answer
MathWorks Support Team
on 4 Dec 2009
Documentation on how ASSIGNIN works with Simulink's mask workspace is missing from the product manual.
ASSIGNIN is a builtin MATLAB function that has been designed to work with MATLAB workspaces. The mask workspace is not a MATLAB workspace. Hence, when the mask initialization function calls ASSIGNIN, the variable is assigned to the MATLAB base workspace.
In order to read or write mask workspace variables, use SET_PARAM or GET_PARAM with the 'MaskWSVariables' parameter.
0 Comments
More Answers (0)
See Also
Categories
Find more on Author Block Masks in Help Center and File Exchange
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!