Main Content

set

Class: Simulink.Mask
Package: Simulink

Set the properties of an existing mask

Syntax

p = Simulink.Mask.get(blockName)
p.set(Name,Value)

Description

p = Simulink.Mask.get(blockName) gets the mask on the block specified by blockName as a mask object.

p.set(Name,Value) sets mask properties that you specify using name–value pairs as arguments.

Input Arguments

blockName

The handle to the block or the path to the block inside the model.

Name-Value Arguments

Specify optional pairs of arguments as Name1=Value1,...,NameN=ValueN, where Name is the argument name and Value is the corresponding value. Name-value arguments must appear after other arguments, but the order of the pairs does not matter.

Before R2021a, use commas to separate each name and value, and enclose Name in quotes.

Type

Text used as title for mask documentation that user sees on clicking Help in the Mask Parameters dialog box.

Default: empty

Description

Text used as summary for mask documentation that user sees on clicking Help in the Mask Parameters dialog box.

Default: empty

Help

Text used as body text for mask documentation that user sees on clicking Help in the Mask Parameters dialog box.

Default: empty

Initialization

MATLAB® code that initializes the mask.

Default: empty

SelfModifiable

Option to set whether the mask can modify itself during simulation.

Default: 'off'

Display

MATLAB code that draws the mask icon.

Default: empty

IconFrame

Option to specify whether the mask icon appears inside a visible block frame.

Default: 'on'

MaskIconOpaque

Option to set the mask icon as opaque or transparent.

Default: 'opaque'

RunInitForIconRedraw

Option to specify whether Simulink® should run mask initialization before executing the mask icon commands.

Default: 'off'

IconRotate

Option to specify icon rotation.

Default: 'none'

PortRotate

Option to specify port rotation.

Default: 'default'

IconUnits

Option to specify whether mask icon is autoscaled, normalized, or scaled in pixels.

Default: 'autoscale'

Examples

  1. Get mask as an object using a masked block’s path.

    p = Simulink.Mask.get('myModel/Subsystem');
  2. Modify the mask so that its mask icon is transparent and its documentation summarizes what it does.

    p.set('IconOpaque','off','Type','Random number generator','Description',...
    'This block generates random numbers.');