Blocks and subsystems can have multiple parameters associated with them. Block masks allow you to expose one or more of these parameters while hiding others from view. Promoting specific parameters to the mask block simplifies the interface and enables you to specify the parameters the user of the block can view and set.
You can use the Promote button on the Mask Editor to promote any underlying parameter of a block either to a block mask or to a subsystem mask. The promoted block parameter gets associated with a parameter in the mask, enabling you to edit the parameter value from the mask dialog box.
Promote parameters from the block dialog box to the mask:
To customize the mask dialog box by moving the required parameters from the block dialog box to the mask dialog box.
To reuse a library block at different instances of a model. For each instance of the library block, you can create individual mask dialog box by promoting parameters for each block.
Consider the block dialog box of the Gain block, which has parameters such as Gain, Multiplication.
To expose only the Gain
parameter, mask the Gain block
and promote the Gain
parameter to the mask dialog box.
Similarly, you can mask a subsystem block and promote parameters to the mask from child blocks of the subsystem block. If the data type of subsystem child block parameters is same, you can associate a single mask parameter with multiple promoted parameters. For example, you can promote multiple Gain parameters in a subsystem to a single dialog box on your mask.
If the parameter is of data type popup
or
DataType
, the options must also be the same for the parameters to
be promoted together. The Evaluate attribute for all the parameters to be
promoted must be similar.
For a related example, see Promote mask parameters
You can also change the attributes of a promoted parameter. For example, you can make a promoted parameter read only or hidden. For more information on attributes, see Property editor.
Select the block whose parameter you want to promote.
On the Block tab, click Create Mask.
In the Mask Editor dialog box, click the Parameters & Dialog tab.
In the Controls pane, click Promote.
In the Property editor pane, next to Type
options, click .
Use the Promoted Parameter Selector dialog box to select the parameters that you want to promote.
To add a parameter to the Promoted parameters list, select a
parameter from the Promotable parameters table and click the
Add to promoted parameter list button .
To view the parameter properties such as Type, hover over the parameter name in the Promotable parameter pane.
Tip
You can use the Child blocks list or the Search box to find underlying block parameters to promote.
To prevent tuning of a property during simulation, you can disable the Tunable attribute while promoting a tunable parameter.
Click OK.
In the Mask Editor dialog box, edit the prompt names for the promoted parameters and click OK. You cannot edit the variable names. You can change the attributes of the promoted parameter in the Property editor section. For example, you can mark the promoted parameter as read-only, evaluate, hidden, and tunable. For more information, see Property editor.
Click OK. Look at the block mask. Only the parameters you promoted are available to set.
Note
You can use Promote all
to promote all parameters. Promote
all is available for all block masks except for subsystem
masks.
To remove a promoted parameter, select the parameter and press Delete key.
You cannot view or promote parameters of a nested masked or linked child block.
Do not promote the parameters of built-in Simulink blocks, as these blocks may have internal callbacks associated with them.
Select the subsystem.
On the Subsystem Block tab, in the Mask group, click Create Mask.
In the Mask Editor dialog box, click the Parameters & Dialog tab.
In the Controls pane, click Promote.
In the Property editor pane, next to Type
options, click .
In the Promoted Parameter Selector dialog box, select the parameters that you want to promote.
To add a parameter to the Promoted parameters list, select a
parameter from the Promotable parameters table and click the
Add to promoted parameter list button .
You can add parameters of the same data type from different child blocks to the
Promoted parameters list. For example, the
Gain
parameter from a different child block can be added to the
Promoted parameters list to promote to the single
Gain
parameter on the mask.
Click OK.
In the Mask Editor dialog box, edit the prompt names for the promoted parameters and click OK. You cannot edit the variable names.
Click OK. Look at the block mask. Only the parameters you promoted are available to set.
When a promoted parameter is disconnected from the underlying block parameter, the promoted parameter is unresolved. Unresolved promoted parameters can cause the model to be erroneous as the promoted parameter cannot find the corresponding block parameter. Promoted parameters can become unresolved for any of these reasons:
The underlying block is deleted.
The underlying block is replaced with another block of same name but does not have the specified parameter.
The underlying block is moved within another mask.
Set the value of a promoted parameter only in the mask dialog box and not in the underlying block dialog box or from the command line.
Parameters once promoted cannot be promoted again to any other mask.
Do not edit the Evaluate attribute of the promoted parameter. This property is inherited from the block parameter.
If you are promoting a nontunable parameter, do not edit the Tunable attribute.
Parameters of a masked or linked child block cannot be viewed or promoted.
Callbacks associated with a block parameter are promoted to the block mask and not to the subsystem mask. User-defined callbacks are sequentially executed after the dynamic dialog callback execute.
You can use Parameter Promotion to promote any underlying parameter of a block either to a block mask or to a subsystem mask. This model contains a subsystem that has 3 Gain blocks ( Gain1, Gain2, and *Gain3 ). The variable K represents the Gain parameter for these Gain blocks. You can promote only the Gain parameter of each of these Gain blocks to the block mask as a single parameter. When you do so, the parameter K is available on the mask for editing and its value will be applied to Gain1 , Gain2 , and Gain3 blocks.
Select the Subsystem block.
On the Subsystem Block tab, in the Mask group, click Create Mask/Edit Mask.
In the Mask Editor dialog box, click the Parameters & Dialog tab.
In the Controls pane, click Promote .
In the Property editor pane, Type options field, click
In the Promoted Parameter Selector dialog box, select Gain1 .
Select Gain from the Promotable parameters table and click the Add to promoted parameter list button. Similarly, add Gain parameter for Gain2.
Click OK .
In the Mask Editor dialog box, edit the prompt names for the Gain parameter. Here the Prompt used is Common gain .
Click OK to finish creating subsystem mask with many-to-one promotion.
Simulate the model. Notice that the value 4 is passed from the mask to the underlying block Gain1, Gain2 , and Gain3 . In this case, the output shows 64.
open_system('promote_block_param_to_mask');