insertParameter
Class: Simulink.Mask
Namespace: Simulink
Syntax
maskObj.insertParameter(index)
maskObj.insertParameter(___,index,Name=Value)
Description
maskObj.insertParameter(
creates and inserts a mask parameter of type edit at the position specified by
index
)index
.
maskObj.insertParameter(___,
creates and inserts a mask parameter at the position specified by index
,Name=Value
)index
.
Input Arguments
maskobj
— Mask object
mask object (default)
Mask object for the masked subsystem.
To get the mask object for a block named blockName
, use this
syntax.
maskObj = Simulink.Mask.get('blockName')
index
— Position
numeric (default)
Position at which to insert the mask parameter, specified as a numeric. The index starts from 1. Specify a value greater than or equal to 1.
Example: 3
Data Types: double
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.
Example: Type = 'edit',Name = 'Parameter1'
Type
— Type of parameter
'edit'
(default) | 'checkbox'
| 'popup'
| 'combobox'
| 'listbox'
| 'promote'
| ...
Type of mask parameter, specified as character vector.
Data Types: string
TypeOptions
— Type options of parameter
cell array
Type options of the parameter, specified as a cell array. This argument applies only if the parameter is one of the following types:
Popup
Combo box
List box
Data Types: cell
Name
— Name of mask parameter
string
The name of the mask parameter, specified as a string. This name is assigned to the mask workspace variable created for this parameter.
Note
If you create a mask parameter with a duplicate name, the software displays a warning but still creates the mask parameter with a different name.
Data Types: string
| char
Prompt
— Display name for mask parameter
string
Display name for the mask parameter, specified as a string. This name appears as the label associated with the parameter on the mask dialog.
Data Types: char
| string
Value
— Mask parameter value
character vector (default)
Mask parameter value, specified as a string. The default value of the mask
parameter in the Mask Parameters dialog. Type specific, depends on the
Type
of the parameter.
Data Types: char
| string
Evaluate
— Option to evaluate mask parameter
on
(default) | off
Option to evaluate the mask parameter, specified as a logical. The available options are:
on — The expression provided in the value property is evaluated.
off — The expression provided in the value property is not evaluated.
Data Types: string
Tunable
— Option to change mask parameter during simulation
on
(default) | off
| run-to-run
Option to change the mask parameter during simulation, specified as a character vector or string. The available options are:
off — You cannot change mask parameter values during simulation in this mode.
on — You can change the mask parameter value during simulation. Each time you make a change the model is compiled.
run-to-run — If the mask parameter is set to run-to-run in Fast Restart mode, the value can be changed between runs. The model is not recompiled to reflect the value in simulation results.
Data Types: string
NeverSave
— Option to save mask parameter value in model file
off
(default) | on
Option to save the mask parameter value in the model file, specified as a logical.
on — The mask parameter value is saved in the model file.
off — The mask parameter value is not saved in the model file.
Data Types: string
Hidden
— Option to hide mask parameter
off
(default) | on
Option to hide the mask parameter in the mask dialog, specified as a logical.
Data Types: string
ReadOnly
— Option to edit mask parameter
off
(default) | on
Option to edit the mask parameter in the mask dialog, specified as a logical.
Data Types: char
Enabled
— Option to enable mask parameter
on
(default) | off
Option to enable the mask parameter in the mask dialog, specified as a logical.
Data Types: char
Visible
— Option to show mask parameter in mask dialog
on
(default) | off
Option to show the mask parameter in the mask dialog, specified as a logical.
Data Types: char
ShowTooltip
— Option to enable tooltips for mask parameter
on
(default) | off
Option to enable tooltips for the mask parameter, specified as a logical value.
Data Types: char
Callback
— Callback code for the mask parameter
string
Callback code for the mask parameter, specified as a character vector. The callback code executes when a user changes the parameter value in the mask dialog box.
Data Types: char
| string
Alias
— Alternative name for mask parameter
string
Alternative name for the mask parameter, specified as a character vector or string.
Data Types: char
| string
VariableName
— Option to associate tunable variable with the popup or radio button parameters
string
Option to associate a tunable variable with the popup or radio button parameters, specified as a character vector or string. This variable appears in the generated code.
Data Types: char
| string
DialogControl
— Layout options
Simulink.dialog.parameter.Edit
object (default) | Simulink.dialog.parameter.Popup
object | Simulink.dialog.parameter.ComboBox
object | ...
Layout options for the parameter in the mask dialog, specified as objects. Use this parameter to specify the location of the parameter, such as the row and prompt placement in the mask dialog. Additionally, you can also control the horizontal stretch or shrink of the mask parameter.
Examples
Insert Mask Parameter at Specific Index
Create a mask object maskobj
on the Subsystem. Insert an edit box with name Speed
on the Subsystem at a specific position.
new_system('insert_parameter'); add_block('built-in/subsystem','insert_parameter/subsystem'); save_system; open_system('insert_parameter'); maskObj = Simulink.Mask.create('insert_parameter/subsystem'); insertParameter(maskObj,1,Type = 'edit',Name ='Speed')
ans = MaskParameter with properties: Type: 'edit' TypeOptions: {0x1 cell} Name: 'Speed' Prompt: '' Value: '[]' ConstraintName: '' Evaluate: 'on' Tunable: 'on' NeverSave: 'off' Hidden: 'off' ReadOnly: 'off' Enabled: 'on' Visible: 'on' ShowTooltip: 'on' Callback: '' Alias: '' VariableName: '' DialogControl: [1x1 Simulink.dialog.parameter.Edit]
Version History
Introduced in R2024a
See Also
MATLAB Command
You clicked a link that corresponds to this MATLAB command:
Run the command by entering it in the MATLAB Command Window. Web browsers do not support MATLAB commands.
Select a Web Site
Choose a web site to get translated content where available and see local events and offers. Based on your location, we recommend that you select: .
You can also select a web site from the following list
How to Get Best Site Performance
Select the China site (in Chinese or English) for best site performance. Other MathWorks country sites are not optimized for visits from your location.
Americas
- América Latina (Español)
- Canada (English)
- United States (English)
Europe
- Belgium (English)
- Denmark (English)
- Deutschland (Deutsch)
- España (Español)
- Finland (English)
- France (Français)
- Ireland (English)
- Italia (Italiano)
- Luxembourg (English)
- Netherlands (English)
- Norway (English)
- Österreich (Deutsch)
- Portugal (English)
- Sweden (English)
- Switzerland
- United Kingdom (English)
Asia Pacific
- Australia (English)
- India (English)
- New Zealand (English)
- 中国
- 日本Japanese (日本語)
- 한국Korean (한국어)