MATLAB Examples

Design a Mask Dialog Box using the Parameters & Dialog Pane

This example shows how to create a mask dialog box using the Parameters & Dialog pane of the Mask Editor. When you mask a block, you encapsulate the block logic and create a custom interface for the block.

Consider a model containing a Subsystem block called AC system. This Subsystem contains an air conditioning system.

Apply a mask on this subsystem block.

In the Mask Editor, use the Parameters & Dialogs pane to add controls on the mask dialog box and manage the mask dialog box layout. Select items from the Controls section to add parameters to the mask dialog box. Use the Property editor section to edit parameter properties.

For example, click Collapsible Panel from the Controls section.

Observe that a collapsible panel container is now added in the Dialog box section. In the Prompt column, type a value to be displayed on the mask dialog box. For example, Manufactures Information . The Name column gets populated automatically when a control is added. You can change this value.

Edit the properties of collapsible panel in the Property editor. Click Preview to view the mask dialog box as you build it.

Similarly, you can add and configure various controls from the Mask Editor to build the mask dialog box.

Observe the mask layout. Containers like group boxes, panels, collapsible panels, and tabs group the controls together. Here, yellow represents Group Box, pink represents Tab, and green represents the Collapsible Panel.

The Button controls type is used to create the Power On button on the mask dialog box. To manage the button placement, apply the Horizontal Stretch property. You can also add callback code to be executed when the button is pressed.

The collapsible panel for Manufacturer's information contains Text and Hyperlink control types.

You can add MATLAB code as a callback for the hyperlink.

The General Controls section contains tabs to segregate and categorize information under Main Controls and Ancillary Controls. The Main Controls tab uses Dials and Slider to accept inputs for air conditioner parameter. You can edit the property of dial and slider in the property editor section of Mask Editor to place them horizontally or vertically.

The Ancillary Controls use Popup, Check Box, and Radio Buttons.

The Advanced Controls section is a collapsible panel that contains spinbox, minimum and maximum parameters to accept inputs.