Block Masks

What Are Masks?

Masks are custom interfaces you can apply to Simulink® blocks. A mask hides the user interface of the block, and instead displays a custom dialog control for specific parameters of the masked block.

When you mask a block, you change only the interface to the block, not its underlying characteristics. Masking a non atomic subsystem does not make it act as an atomic subsystem, and masking a virtual block does not convert it to a nonvirtual block.

    Note:   You cannot save a mask separately from the block that it masks. Also you cannot create an isolated mask definition and apply it to more than one block.

The mask icon and mask dialog box are analogous to the block icon and block dialog box, respectively.

You can use the mask parameters to control the mask display and change underlying subsystem content dynamically (add or delete blocks and set the parameters of those blocks). However, you can change subsystem content dynamically only if the subsystem is part of a library.

When to Use Masks?

Masks are useful for customizing block interfaces, encapsulating logic, and providing restricted access to data.

Masks are comparable to subsystems, in that they both simplify the graphical appearance of a model. However, subsystems do not offer an interface for users to interact with underlying block parameters.

Consider masking a Simulink block when you want to:

  • display a meaningful dynamic icon that reflects values within a block

  • define customized parameters whose names reflect the purpose of a block

  • provide a dialog box that enables you to access only select parameters of the underlying blocks

  • provide users customized description that is specific to the masked block

If you use a mask only to represent the contents of a subsystem, consider using content preview instead. For that usage, content preview has these advantages, compared to using a mask:

  • Automatically update changes in the subsystem (for a masked block, you need to manually update the mask image that represents the content of the item).

  • Eliminates the setup tasks for icons for masked blocks.

Masked blocks do not support content preview. For details, see Preview Content of Hierarchical Items.

    Tip   To view the masking examples, see Simulink Masking Examples. Notice that the examples of similar type are grouped together. In an example model,

    • To view the mask definition, double-click the View Mask block.

    • To view the mask dialog box, double-click the block.

More About

Was this topic helpful?