Using Simulink | ![]() ![]() |
Predefined Masked Dialog Parameters
Simulink associates the following predefined parameters with masked dialogs.
MaskCallbacks
The value of this parameter is a cell array of strings that specify callback expressions for the dialog's user-defined parameter controls. The first cell defines the callback for the first parameter's control, the second for the second parameter control, etc. The callbacks can be any valid MATLAB expressions, including expressions that invoke M-file commands. This means that you can implement complex callbacks as M-files.
The easiest way to set callbacks for a mask dialog is to first select the corresponding masked dialog in a model or library window and then to issue a set_param
command at the MATLAB command line. For example, the following code
defines callbacks for the first and third parameters of the masked dialog for the currently selected block. To save the callback settings, save the model or library containing the masked block.
MaskDescription
The value of this parameter is a string specifying the description of this block. You can change a masked block's description dynamically by setting this parameter.
MaskEnables
The value of this parameter is a cell array of strings that define the enabled state of the user-defined parameter controls for this dialog. The first cell defines the enabled state of the control for the first parameter, the second for the second parameter, etc. A value of 'on'
indicates that the corresponding control is enabled for user input; a value of 'off'
indicates that the control is disabled.
You can enable or disable user input dynamically by setting this parameter in a callback. For example, the following command in a callback
would disable the third control of the currently open masked block's dialog. Simulink colors disabled controls gray to indicate visually that they are disabled.
MaskPrompts
The value of this parameter is a cell array of strings that specify prompts for user-defined parameters. The first cell defines the prompt for the first parameter, the second for the second parameter, etc.
MaskType
The value of this parameter is the mask type of the block associated with this dialog.
MaskValues
The value of this parameter is a cell array of strings that specify the values of user-defined parameters for this dialog. The first cell defines the value for the first parameter, the second for the second parameter, etc.
MaskVisibilities
The value of this parameter is a cell array of strings that specify the visibility of the user-defined parameter controls for this dialog. The first cell defines the visibility of the control for the first parameter, the second for the second parameter, etc. A value of 'on'
indicates that the corresponding control is visible; a value of 'off'
indicates that the control is hidden.
You can hide or show user-defined parameter controls dynamically by setting this parameter in the callback for a control. For example, the following command in a callback
would hide the control for the currently selected block's second user-defined mask parameter. Simulink expands or shrinks a dialog to show or hide a control, respectively.
![]() | Setting Masked Block Dialog Parameters | Simulink Debugger | ![]() |