Main Content

Mask Callback Code

Mask callback allows you to customize the behavior of mask dialog if there is a change in the mask dialog. For example, certain block parameter in the mask dialog is disabled or enabled upon changing the value of a block parameter in the mask dialog.

Execute Callback Code

Mask parameter callback codes are executed in a temporary workspace and not in the base workspace. If you need a variable created in the callback to be available later (not during callback processing), you must explicitly assign those variables to the base workspace.

Simulink® executes the callback commands when there is a change in the value of the parameter. Parameter callbacks are executed in the following scenarios:

  • Open mask dialog box and callback commands execute sequentially, starting with the top mask dialog box.

  • Modify a parameter value in the mask dialog box and then change the cursor location/ press Apply. For example, you press the Tab key or click into another field in the dialog box after changing the parameter value.

  • Modify the parameter value by using the set_param command.

  • Open the model with Edit Time Warnings and Errors in Diagnostics enabled.

  • If you close a mask dialog box without saving the changes, the Callback command for parameters is executed sequentially.

Note

  • Buttons on mask dialog box are unavailable when the callback code associated with the button is being executed.

  • Callback commands do not execute if the mask dialog box is open when the block tool tip appears.

Related Topics