Skip to Main Content Skip to Search
Product Documentation

Masking Blocks and Promoting Parameters

Masking Built-In Blocks Directly and Within Subsystems

You can directly mask built-in blocks with the Mask Editor to provide custom icons and dialog boxes. In the Mask Editor, you can choose to promote any underlying parameter of any block to the mask. For subsystems, you can choose to promote parameters from any child blocks. For a subsystem block, you can associate a single mask parameter with multiple promoted parameters if they are of the same type. Changing the value of the mask parameter also sets the value of the associated promoted parameters.

You can use masking in the following use cases:

Promoting Block Parameters to the Mask

  1. Right-click your block or subsystem and select Create Mask.

  2. In the Mask Editor, select the Parameters pane.

  3. To choose one or more parameters for promotion:

    1. Create a new mask parameter by clicking Add Parameter.

    2. Click the Promote button, just beneath the Add Parameter button.

      The Promoted parameter selector dialog box opens.

    3. Choose underlying block parameters to promote to the currently selected mask parameter:

      • Select a parameter in the Promotable parameters table and click the right-arrow button to add to the Promoted parameters list.

          Tip   View the tooltips on promotable parameters to see key fields such as Type.

      • If you are masking a subsystem, you can use the Child blocks list or the Search box to find the underlying block parameters that you want to promote.

      • (Optional) If you are masking a subsystem, you can associate multiple promoted parameters with the currently selected mask parameter, provided they are of the same type. For example, you can promote multiple Gain parameters in a subsystem to a single prompt on your mask.

    4. Click OK to return to the Mask Editor.

  4. Observe that the Type field is now disabled because you have promoted a parameter to this mask parameter. Type is always disabled. Variable is also disabled if you are directly masking a built-in block and not a subsystem.

    The Relative block path table shows you the location of the underlying original block (where "." means "self"). You can click the link under Relative block path to open the underlying block.

  5. Edit the prompt names for the mask, if desired. You cannot edit the variable names of built-in block parameters. See Rules for Promoting Parameters.

  6. Repeat step 3 to add mask parameters and add or edit additional promoted parameters.

      Tip   If you want to promote many parameters from a built-in block, click Promote All to save time.

      The Promote All button is only available for block masks, not subsystem masks.

      All the parameters appear in the Mask Editor. To remove any unwanted parameters, use the Delete Parameter button.

  7. Click OK to finish editing the mask.

Now whenever you set a mask parameter, you also set the value of the underlying promoted parameters.

Creating a Simplified Custom Interface for a Built-In Block

You can directly mask a built-in block to simplify the interface and add custom parameters. The following example demonstrates how to mask the Gain block and promote only the Gain parameter to the mask, while hiding the other options and adding custom parameters.

  1. Right-click your Gain block and select Create Mask.

  2. In the Mask Editor, select the Parameters pane.

  3. Create a new mask parameter by clicking Add Parameter.

  4. Click the Promote button, just beneath the Add Parameter button. .

    The Promoted parameter selector dialog box opens.

  5. Select the Gain parameter in the Promotable parameters table and click the right-arrow button to add to the Promoted parameters list.

  6. Click OK to return to the Mask Editor.

  7. Observe that fields such as Variable and Type are now disabled because you have promoted a built-in parameter to this mask parameter, and the Relative block path table shows you the location of the underlying original block (where "./" means "self"). You can click the link in the Relative block path table to open the underlying Gain block.

  8. (Optional) Add custom mask parameters by clicking Add Parameter. The example shown next adds an edit box for company notes.

  9. Click OK to finish creating the mask.

  10. Double-click the Gain block. The new mask opens, showing only the promoted Gain parameter and custom parameter.

  11. Look under the mask to see the underlying Gain block dialog box. You can see that the Gain parameter is now disabled because you have promoted it to the mask.

Creating a Simplified Custom Interface for Multiple Parameters in a Subsystem

You can promote multiple parameters from child blocks to a single mask parameter for a subsystem block. This enables you to use a simplified single setting in the mask to set multiple child block parameters (of the same type) in the subsystem.

The following example demonstrates this capability. It recreates the functions of the Ramp block by using other blocks in a subsystem, and then masking the subsystem to create a simplified custom interface.

The Mask Editor contains a selection of promoted parameters from underlying blocks within the subsystem. The selected parameter has three underlying parameters of the same type promoted to the same mask parameter.

The Promoted parameter selector dialog shown next demonstrates how to specify this setup. Three parameters of the same type, from different child blocks, are added to the Promoted parameters list to promote to the currently selected mask parameter.

The mask shows the four parameters specified in the Mask Editor.

When you select the Interpret vector parameters as 1-D check box on the mask, you also set the underlying promoted parameters in the three child blocks.

Rules for Promoting Parameters

General rules:

When promoting parameters from a directly masked built-in block:

Promoting parameters from child blocks within subsystems:

Links created from masked blocks:

  


Related Products & Applications

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