Documentation Center

  • Trial Software
  • Product Updates

addParameter

Class: Simulink.Mask
Package: Simulink

Add a parameter to a mask

Syntax

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

Description

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

p.addParameter(Name,Value) appends a parameter to the mask. If you do not specify name–value pairs as arguments with this command, Simulink® creates an unnamed mask parameter with control type set to edit.

Input Arguments

blockName

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

Name-Value Pair Arguments

Specify optional comma-separated pairs of Name,Value arguments. Name is the argument name and Value is the corresponding value. Name must appear inside single quotes (' '). You can specify several name and value pair arguments in any order as Name1,Value1,...,NameN,ValueN.

'Type'

Type of control that is used to specify the value of this parameter.

Default: edit

'TypeOptions'

The options that are displayed within a popup control or in a promoted parameter. This field is a cell array.

Default: empty

'Name'

The name of the mask parameter. This name is assigned to the mask workspace variable created for this parameter.

Default: empty

'Prompt'

Text that identifies the parameter on the Mask Parameters dialog box.

Default: empty

'Value'

The default value of the mask parameter in the Mask Parameters dialog box.

Default: Type specific; depends on the Type of the parameter

'Evaluate'

Option to specify whether parameter must be evaluated.

Default: 'on'

'Tunable'

Option to specify whether parameter is tunable.

Default: 'on'

'Enabled'

Option to specify whether user can set parameter value.

Default: 'on'

'Visible'

Option to set whether mask parameter is hidden or visible to the user.

Default: 'on'

'Callback'

Container for MATLAB® code that executes when user makes a change in the Mask Parameters dialog box and clicks Apply.

Default: empty

'TabName'

The name of the tab in the Mask Parameters dialog box where the parameter appears.

Default: empty

Examples

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

    p = Simulink.Mask.get('myModel/Subsystem');
  2. Add a parameter to the mask without specifying name–value pairs for parameter attributes.

    p.addParameter;
  3. Add a mask parameter of type popup that cannot be evaluated and appears on a tab named Properties in the Mask Parameters dialog box.

    p.addParameter('Type','popup','TypeOptions',...
    {'Red' 'Blue' 'Green'},'Evaluate','off','TabName','Properties');

See Also

Was this topic helpful?