MATLAB: Simulink mask callback adding variables to workspace

simulink subsystem mask callback workspace

Hi, I have a subsystem with a mask and a callback function based on what option the user chooses in the mask dialogue. I set some variables in the callback function as below
rev = 1
The variable appears in the matlab workspace. Is there a way to keep the variable from appearing in the workspace but still be able to use it in the callback function code? Thanks, Amish

Best Answer

You can take all that initialization code and move it from a block callback to the "Initialization" tab of the Mask Editor. The variables created will belong only to the masked block's workspace, so they cannot be tampered with in the base workspace.
- Sebastian