| Contents | Index |
| On this page… |
|---|
The Parameters pane allows you to create and modify masked parameters that determine the behavior of the masked block or subsystem.

The Parameters pane contains the following elements:
The Dialog parameters pane allows you to select and change the major properties of the mask parameters. See Dialog Parameters Pane for more information.
The buttons on the left side of the Parameters pane allow you to add, delete, and change the order of appearance of parameters on the Mask Parameters dialog box, and promote parameters from underlying blocks. See Dialog Parameters Pane for more information.
The Type-specific options pane allows you to set additional options for some control types (the Type attribute in the Dialog parameters pane).
The Generic options pane allows you to set additional options for the parameter.
This table explains the purpose of the buttons that appear on the Parameters pane.
| Button | Action |
|---|---|
|
Add | Add a new mask parameter. An empty parameter appears in the adjacent Dialog parameters table. If you select an parameter, the new parameter appears below the selected parameter. |
|
| Promote underlying block parameter(s) to the currently selected mask parameter. A dialog box opens where you can choose parameter(s) to promote from the underlying blocks. See Masking Blocks and Promoting Parameters. |
|
Delete | Delete the parameter that is currently selected in the Dialog parameters table. |
|
Up | Move the currently selected parameter up one row in the Dialog parameters table. The prompt for this parameter moves up one slot in the Mask Parameters dialog box. |
|
Down | Move the currently selected parameter down one row in the Dialog parameters table. The prompt for this parameter moves down one slot in the Mask Parameters dialog box. |
|
| Promote all underlying block parameters to the mask. All the parameters appear in the Dialog parameters table. Delete any unwanted parameters. This option can save time if you want to promote many parameters from a built-in block. |
Lists the mask parameters in tabular form. Each row displays the major attributes of one of the mask parameters.
Text that identifies the parameter on a Mask Parameters dialog box.

Name of the variable that stores the parameter value in the mask workspace. You can use this variable as the value of parameters of blocks inside the masked subsystem, allowing the masked block user to set the parameters through the Mask Parameters dialog box.
Note The set_param and get_param commands are insensitive to case differences in mask variable names. For example, suppose a model named MyModel contains a masked subsystem named A that defines a mask variable named Volume. Then, the following line of code returns the value of the Volume parameter. get_param('MyModel/A', 'voLUME')However, case does matter when using a mask variable as the value of a block parameter inside the masked subsystem. For example, suppose a Gain block inside the masked subsystem A specifies VOLUME as the value of its Gain parameter. This variable name does not resolve in the masked subsystem's workspace, as it contains a mask variable named Volume. If the base workspace does not contain a variable named VOLUME, simulating MyModel produces an error. |
The mask variable name set by the Variable field cannot duplicate any parameter name in or beneath the mask. Therefore, you cannot use any built-in block parameter name, such as name, as a mask variable name. Violating this requirement causes an error when you apply changes in the Mask Editor.
Type of control that is used to specify the value of this parameter. Some examples of the types of controls you can specify include edit boxes, check boxes, and data type controls. See Control Types for details about the control types you can specify.
The control appears on the Mask Parameters dialog box following the parameter prompt.
Simulink can use the value of a mask parameter as the user enters it in the Mask Parameters dialog box, or it can evaluate what the user specifies and use the result of the evaluation. Select the Evaluate option for a parameter to specify parameter evaluation (the default) or clear the option to suppress evaluation.
If checked, the Evaluate option causes Simulink to evaluate the expression that the user enters, before assigning that value to the variable. Otherwise, Simulink treats the expression as a string value and assigns that string to the variable. For example, if you check Evaluate option, then if the user enters the expression gain in an edit field, Simulink evaluates gain and assigns the result to the variable. Otherwise, Simulink assigns the string 'gain' to the variable. The effect of the Evaluate option depends on the control type, as shown in Control Types.
If you need both the string entered and the evaluated value, clear the Evaluate option. To get the value of a base workspace variable entered as the literal value of the mask parameter, use the MATLAB evalin command in the mask initialization code. For example, suppose the masked block user enters the string 'gain' as the literal value of the mask parameter k, where gain is the name of a base workspace variable. To obtain the value of the base workspace variable, use the following command in the mask initialization code:
value = evalin('base', k)
By default, the masked block user can change a Mask Parameters dialog box parameter value during simulation. Clear the Tunable option to prohibit the changing of the parameter value during simulation.
If the masked block does not support parameter tuning, Simulink ignores the Tunable option setting of a mask parameter. See Using Tunable Parameters for information about parameter tuning and the blocks that support it.
The name of the tab that contains a parameter.
To group multiple parameters in one tab, use the same tab name for each of the parameters that you want to be on a tab.
If you specify a tab name for one parameter, then any other parameters for which you do not specify a tab name appear in the Mask Parameters dialog box under a blank tab.
The parameters on a tab appear in the order in which the parameters appear in the Dialog parameters table. You do not have to group all the parameters for a tab together in the Dialog parameters table.
For example, you can specify two tabs for parameters:

That definition of the two tabs produces the following Mask Parameters dialog box:

You can choose how a masked block user selects or enters parameter values. To specify the type of control that the Mask Parameters dialog box provides for a mask parameter, set the Type parameter to one of the following options.
| Control | Masked Block User Interaction |
|---|---|
| edit | Enters a parameter value by typing it into a field |
| checkbox | Chooses between two alternatives by selecting or deselecting a check box |
| popup | Selects a parameter value from a list of possible values |
| DataTypeStr | Enters a data type or selects one from a list of data types, and optionally opens the Data Type Assistant |
| Minimum | Specifies a minimum value |
| Maximum | Specifies a maximum value |
For example, this figure shows the Parameters pane of a Mask Parameters dialog box that uses three types of controls, with the pop-up control open to show its possible values:

An edit control enables the user to enter a parameter value by typing it into a field. This figure highlights the definition of the Slope prompt, which uses an edit control.

The Evaluate option determines whether Simulink evaluates the value that the user enters for this parameter.
Edit Control Evaluation
| Evaluation | Edit Control Parameter Value |
|---|---|
| On | The result of evaluating the expression entered in the field |
| Off | The literal string entered in the field |
A check box enables the user to choose between two alternatives by selecting or clearing a check box. This figure shows the definition of the Saturate check box control.

The Evaluate option determines whether Simulink evaluates the value that the user enters for this parameter.
Check Box Evaluation
| Evaluation | Check Box Parameter State | Check Box Parameter Value |
|---|---|---|
| On | Selected | 1 |
| Cleared | 0 | |
| Off | Selected | 'on' |
| Cleared | 'off' |
A pop-up control enables the user to choose a parameter value from a list of possible values. When you define a pop-up control, specify the values that the control presents to the user in the Mask Parameters dialog box. To specify the values, select the parameter in the Dialog parameters table, then enter the values in the Popups field of the Type-specific options below the table. The next figure shows the pop-up control definition for the Color prompt.

The value of the variable associated with the parameter (Color) depends on the item selected from the pop-up list and whether you select the Evaluate option.
Pop-Up Evaluation
| Evaluation | Pop-Up Parameter Value |
|---|---|
| On | The index of the value selected from the list, starting with 1. For example, if the third item is selected, the parameter value is 3. |
| Off | The literal string that is the value selected, as it appears in the Mask Editor Popups field and the corresponding Mask Parameters dialog box list. |
A data type control enables the masked block user to specify a data type for a mask parameter. The data type control provides the masked block user with a drop-down list of data types, and a button to open the Data Type Assistant. For details about the Data Type Assistant, see Working with Data Types.
A data type control is particularly useful when you include a masked block in a user-defined library. For information about using masked blocks in user-defined libraries, see Masks on Blocks in User Libraries.
When you define a data type control, specify the data type or data types that the control presents to the user in the Mask Parameters dialog box. To specify the data type options from which a user can choose, in the Dialog parameters table, select the parameter, and then use one or more of the following tabs in the Type-specific options pane:
Inherit rules — Specify inheritance rules for determining the data types.
Built-in types — Specify one or more built-in Simulink data types, such as double or int8.
Fixed-point — Specify the scaling and signedness modes for a fixed-point data type.
User-defined — Specify a bus or enumerated (enum) data type, or both.
The next figure shows a data type control definition for an Output Data Type prompt that allows the masked block user to select any built-in type. (To restrict the user choices to only built-in data types, do not select any check boxes in the Fixed-point and User-defined tabs.)

Specifying Inheritance Rules. To specify one or more inheritance rules for the data type control, on the Inherit rules tab, select the appropriate check boxes.

By default, the Inherit rules tab includes two groups of rules:
Common Simulink rules
Advanced Simulink rules
The Common Simulink rules are inheritance rules that apply to many blocks in the Simulink library. The Advanced Simulink rules are inheritance rules that apply to one or only a few Simulink blocks.
If there are any custom inheritance rules registered on the MATLAB search path, then the Inherit rules tab also includes a third group of rules: Custom Simulink rules.
To register custom inheritance rules, use the sl_customization function:
Navigate to the MATLAB search path.
Create an sl_customization.m file, if that file does not already exist.
At the MATLAB command line, enter:
function sl_customization(cm)
In the sl_customization function definition, use an InheritRuleCustomizer.registerCustomRules() method, specifying a cell array of strings, with each string defining an inheritance rule to be registered.
Each inheritance rule name must begin with Inherit: (for readability, include a space after Inherit:)
Not include any of these characters:
|
{
}
,
The following is an example of an sl_customization function that registers two custom inheritance rules:
function sl_customization(cm)
cm.InheritRuleCustomizer.registerCustomRules( …
{'Inherit: Custom rule 1', …
'Inherit: Custom rule 2'});
end
where Custom rule 1 and Custom rule 2 are the names of the custom inheritance rules that you want to appear in the Mask Editor interface.
For more information about using the sl_customization function, see About Registering User Interface Customizations.
Use the Initialization pane of the Mask Editor to add mask initialization code that specifies how Simulink configures blocks in the mask when the user of the masked block specifies either Custom rule 1 or Custom rule 2.
To display the custom inheritance rules group in the Inherit rules tab of the Mask Editor, do one the following steps:
At the MATLAB command line, type sl_refresh_customization.
Restart MATLAB.
Specifying a Fixed-Point Data Type. To specify a fixed-point data type for a parameter:
Select the parameter in the Dialog parameters table.
In the Type-specific options pane, select the Fixed-point tab.
Select the appropriate scaling and signedness mode check boxes. If you do not select a mode, then the masked block user cannot choose a fixed-point data type.
Also in the Type-specific options pane, select the Associations tab.
The masked block user can use the association when specifying a fixed-point data type with the Data Type Assistant. For a value or value range for a signal, the association can help the user select the data type with the best precision for the value or the value range.
Specify the minimum, maximum, and value for the fixed-point data.
Specifying an Enumerated Data Type. To specify an enumerated (enum) data type:
Select the parameter in the Dialog parameters table.
In the Type-specific options pane, select the User-defined tab.
Select the Enumerated check box.
Specifying a Bus Data Type. To specify a bus data type:
Select the parameter in the Dialog parameters table.
In the Type-specific options pane, select the User-defined tab.
Select the Bus check box.
If you specify a bus data type as one of the data types that a masked block user can specify in the Mask Parameters dialog box, then you must add code in the Initialization pane. Add code to handle the way that the Data type parameter of an underlying block specifies the data type. See Initialization Pane for more information about adding code to the Initialization pane.
To handle cases where the Data type parameter of an underlying block specifies the data type by including the mask parameter variable as a literal (for example, 'outportdatatype'), add code similar to this example:
maskDTPrmString = get_param(gcb, MaskDTPrmName);
if is_a_bus_type(MaskDTPrmString)
blockDTPrmString = get_param(BlockUnderMask, BlockDTPrmName);
set_param(BlockUnderMask, BlockDTPrmName, ...
['Bus: ' blockDTPrmString];
end
To handle cases where the Data type parameter of an underlying block specifies the data type by including the mask parameter variable in the Bus: <object> form, add code similar to this example:
maskDTPrmString = get_param(gcb, MaskDTPrmName);
if ~is_a_bus_type(maskDTPrmString)
blockDTPrmString = get_param(BlockUnderMask, BlockDTPrmName);
set_param(BlockUnderMask, BlockDTPrmName, ...
remove_bus_colon_prefix(blockDTPrmString));
end
Data Type Evaluation. Simulink enables the Evaluate option for data type controls. You cannot change this setting.
A minimum or maximum control enables the masked block user to enter a value for the Minimum or Maximum parameters of an underlying block.
This figure highlights the definition of a Minimum prompt, which uses the Minimum control.

Minimum and Maximum Control Evaluation. Simulink enables the Evaluate option for Minimum and Maximum controls. You cannot change this setting.
This pane allows you to set additional options for the parameter selected in the Dialog parameters table.
Clearing this option grays the selected parameter prompt and disables its edit control. This means that the masked block user cannot set the value of the parameter.
The selected parameter appears on the masked block's parameter dialog box only if this option is checked (the default).
Enter the MATLAB code that you want Simulink to execute when a masked block user applies a change to the selected parameter by selecting the Apply or OK button on the Mask Parameters dialog box. You can use such callbacks to create dialog boxes that change in appearance depending on the changes the user makes to control settings, such as enabling an edit field when a user selects a check box.
Note Do not use callbacks to alter the contents of a masked subsystem. Altering contents in a callback, for example, by adding or deleting blocks or changing block parameter values, can trigger errors during model update or simulation. If you need to modify the contents of a masked subsystem, use the mask's initialization code to perform the modifications. See Initialization Pane for more information. |
The callback can create and reference variables only in the mask workspace. If the callback needs the value of a mask parameter, it can use get_param to obtain the value, for example:
if str2num(get_param(gcb, 'g'))<0
error('Gain is negative.')
endSimulink executes the callback commands when you:
Open the mask parameter dialog box. Callback commands execute top down, starting with the top mask dialog parameter.
Modify a parameter value in the mask parameter dialog box, then change the cursor focus by pressing the Tab key or clicking into another field in the dialog box.
Modify the parameter value, either in the Mask Parameters dialog box or through a call to set_param, then apply the change by clicking Apply or OK. Any mask initialization commands execute after the callback commands. See Initialization Pane for more information.
Cancel any changes that the user has made and applied in the Mask Parameters dialog box by clicking Cancel.
Hover over the masked block to see its data tip, when the data tip contains parameter names and values. The callback executes again when the block data tip disappears.
![]() | Icon & Ports Pane | Initialization Pane | ![]() |

Learn more about Simulink through this collection of videos, articles, technical literature and the Getting Started with Simulink Guide.
| © 1984-2012- The MathWorks, Inc. - Site Help - Patents - Trademarks - Privacy Policy - Preventing Piracy - RSS |