The following sample code shows how to change the names and access the values of the variables in the Mask Editor of a masked subsystem from the MATLAB command line:
To be able to execute this code, download the attached sample model autoMask_model.mdl and select the subsystem.
1. To rename the variables in the Mask Editor to be ‘a’ as the first variable and ‘b’ as the second variable use:
set_param(gcb,'MaskVariables', ['a=@1', ';', 'b=@2'])
get_param(gcb,'MaskVariables')
2. To set and access the values of the variables 'a' and 'b' use:
set_param(gcb,'MaskValueString','5|6')
get_param(gcb,'MaskValueString')
3. To change the ‘Prompts’ names in the window properties of the masked subsystem use:
set_param(gcb,'MaskPromptString','New_hello|New_inc')
get_param(gcb,'MaskPromptString')
Best Answer