MATLAB: How to pass the mask parameter to a goto block underneath and to the GotoTag parameter in Simulink 8.0 (R2012b)

simulink

I have one mask parameter that I am trying to pass to a goto block underneath and to the GotoTag parameter.

Best Answer

With respect to the modifying GOTO tag names, using Mask Parameters, I am attaching a SLX file here.
SLX file : MathWorksTS_ExampleMaskParameter_for_Goto.slx which has two subsystems 'Subsystem' and 'Subsystem1'.
'Subsystem' demonstrates usage of 'set_param' along with a Dialog Callback of the Dialog Parameter for 'GOTO_NAME'. The callback is in 'MaskDialogCallback.m' script in the ZIP folder. The script changes the 'GotoTag' of the Goto block with the provided string value.
The 'MaskDialogCallback.m' script should have the following code:
blk = gcb;
GotoTagString = get_param(blk,'GOTO_NAME');
set_param([gcb '/Goto'],'GotoTag',GotoTagString)
Please note, usage of 'set_param' might not be the ideal scenario, because it might lead to possible conflicts and hence it is not recommended to use 'set_param' for blocks under the mask.
Another option is if you know of all possible 'Goto' blocks then can use a Switch Case in the Mask Dialog to select one of the Goto block. The 'Subsystem1' demonstrates this workflow. Edit the mask to understand the workflow. The different Goto blocks are inside the 'Switch Case Action Subsystem' blocks. This is a recommended workflow if you are aware of all available goto blocks.