addParameterConstraint
Class: Simulink.Mask
Namespace: Simulink
Add parameter constraint to a mask
Syntax
paramConstraint = maskObj.addParameterConstraint(Name,Value)
Description
adds a constraint to the specified mask. Constraints can only be associated to the
Edit type mask parameters.paramConstraint
= maskObj
.addParameterConstraint(Name,Value
)
Input Arguments
maskObj
— Block mask handle
mask object
Block mask handle, specified as a mask object. You can use the
Simulink.Mask.get
command to get the block mask handle. For more
information, see Simulink.Mask.get
Data Types: char
| cell
Name-Value Arguments
Specify optional comma-separated pairs of Name,Value
arguments.
Name
is the argument name and Value
is the
corresponding value. You can specify several name and value pair arguments in any order as
Name1,Value1,...,NameN,ValueN
.
Name
— Mask constraint name
character vector | string
Required field. Must be a valid MATLAB name. Specifies a name for the mask parameter constraint.
Parameters
— Mask parameter name
cell array of character vector | string
Optional field. Specifies the Edit mask parameter name to which you want to associate the constraint.
Rules
— Rule for mask parameter constraint
'DataType'
| 'Dimension'
| 'Complexity'
| 'Sign'
| 'Finiteness'
| 'Minimum'
| 'Maximum'
| 'CustomConstraint'
Required field. Rules are defined within curly braces. A constraint can have single or multiple rules.
Name-Value Pairs for Rules
Name |
Value |
---|---|
DataType | double , single ,
numeric , integer ,
int8 , uint8 , int16 ,
uint16 , int32 ,
uint32 , boolean ,
enum , fixdt |
Dimension | scalar , row vector , column
vector , 2-D matrix , n-D
matrix |
Complexity | real , complex |
Sign | positive , negative ,
zero |
Finiteness | finite , inf ,
-inf , NaN |
Minimum | character vector |
Maximum | character vector |
CustomConstraint |
Valid MATLAB expression returning logical true or false. |
CustomErrorMessage | character vector or a message catalog ID. If you use the message catalog ID to specify an error, the error message must not have any holes in it. This error message is specifically for custom constraint validation failure. |
Output Arguments
paramConstraint
— Mask parameter constraint
character vector | string
Handle to the mask parameter constraint, returned as a character vector. You can associate a constraint to the mask parameter either during or after creating the constraint.
Examples
Create Mask Constraint
Get block mask handle.
maskObj = Simulink.Mask.get(gcb);
Create mask constraint.
paramConstraint = maskobj.addParameterConstraint(... 'Name','const2',... 'Parameters',{'Parameter1'},... 'Rules',{'DataTypes',{'uint8','uint16'}})
paramConstraint = Constraints with properties: Name: 'const2' ConstraintRules: [1×1 Simulink.Mask.ParameterConstraintRules]
Version History
Introduced in R2018a
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 (한국어)