Main Content

Create Block Masks

Create customized appearance, create user–defined interface, encapsulate logic, and hide data for subsystems and custom blocks

Simulink® enables you to create block masks. A mask is a custom user interface for a block.

By masking a block you encapsulate the block diagram to have its own parameter dialog box with its own block description, parameter prompts, and help texts.

You can mask an independent custom block that you can reuse as unique blocks like those defined in Simulink.

To know about creating a block mask, see Create a Simple Mask.

Classes

Simulink.MaskControl masks programmatically
Simulink.Mask.ConstraintsCreate Mask Constraint
Simulink.MaskParameterControl mask parameters programmatically
Simulink.Mask.EnumerationBaseDerive an enumeration class to hold numeric values of any datatype
Simulink.Mask.EnumerationTypeOptionsParse information from enumeration file derived from Simulink.IntEnumType and Simulink.Mask.EnumerationBase
Simulink.dialog.ControlCreate instances of dialog control
Simulink.dialog.parameter.CustomTableCreate custom tables programmatically
Simulink.dialog.ListboxControlControl listbox programmatically
Simulink.dialog.TreeControlControl Tree control programmatically
Simulink.dialog.LookupTableControlControl mask lookup tables programmatically
Simulink.dialog.LookupTableControl.TableControl table data for mask lookup table
Simulink.dialog.LookupTableControl.BreakpointsControl breakpoint data set for mask lookup table

Topics

Introduction to Masking

Masking Fundamentals

Learn the basics about masking and when to mask blocks.

Create a Simple Mask

Create and customize a block mask.

Manage Existing Masks

View or edit an existing block mask.

Mask Editor User Interface

Mask Editor Overview

Create and customize masks using the Mask Editor interface.

Specify Data Types Using DataTypeStr Parameter

Add data type constraint for an Edit mask parameter.

Design a Mask Dialog Box

Try this example to create a mask dialog box and understand the use of some Mask Editor features.

Handling Large Number of Mask Parameters

Add large number of mask parameters in a Table programmatically.

Customize Tables for Masked Blocks

Add custom tables to mask dialog box.

Control Custom Table Programatically

Use Command Line Interface to control custom tables.

Masking Features

Validating Mask Parameters Using Constraints

Add validation to mask parameters using constraints.

Custom Constraints

Create custom constraints using MATLAB logical expressions.

Shared Constraints

Save constraints in a MAT file and share it with multiple block masks.

Mask Callback Code

Add and execute mask callback code.

Initialize Mask

Use MATLAB® code to initialize a block mask.

Promote Parameter to Mask

Expose specific block parameters to the mask.

Control Masks Programmatically

Simulink® defines a set of parameters that help in setting and editing masks.

Pass Values to Blocks Under the Mask

Specify input values using the mask dialog box.

Mask Linked Blocks

Add custom interface to linked blocks.

Approaches to Control Active Variant Choice of a Variant Block Using Mask or Model Workspace

This example shows different approaches to control the active choice of inline variant and Variant Subsystem blocks from a mask or a model workspace.

Define Measurement Units for Masked Blocks

Set measurement units for output and input ports of a masked block.

Add Images in Masks

Add images as mask icons and save them in the SLX file.

Create Hierarchical List in Mask Dialog

Create a hierarchical list of data on a mask.

Tune Mask Popup Parameters by Referencing an External Enumeration File

Reference external enumeration file to assign numerical values to popup parameter.

Visualize and Edit N-Dimensional Data Using Mask Lookup Table Control

You can visualize and edit N-dimensional lookup table data in mask dialog using the lookup table control.

Mask Callbacks

Dynamic Mask Dialog Box

Change the mask dialog box based on user - input.

Dynamic Masked Subsystem

Create masked library blocks that can modify their structural contents.

Debug Masks That Use MATLAB Code

Troubleshoot errors in the mask initialization code.

Model Mask

Introduction to System Mask

Learn about masking a model.

Create and Reference a Masked Model

Mask a model interactively.

Control Model Mask Programmatically

How to mask a model programmatically.

Example Models

Masking Example Models

View Simulink models that demonstrate masking capabilities.

Featured Examples