Main Content

addCrossParameterConstraint

Class: Simulink.Mask
Package: Simulink

Add cross-parameter constraint

Syntax

CrossConstraint = maskObj.addCrossParameterConstraint(Name,Value)

Description

CrossConstraint = maskObj.addCrossParameterConstraint(Name,Value) adds a constraint among parameters of a mask.

Input Arguments

expand all

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 property name and Value is the corresponding value. You can specify several name and value pair arguments in any order as Name1,Value1,...,NameN,ValueN.

Cross-parameter constraint name, specified as a character vector. Must be a valid MATLAB value.

Cross-parameter constraint rule, specified as a valid MATLAB expression that returns logical true or false. You can specify multiple rules by separating them with a logical operators like &&. For example, parameter1 > parameter2 && parameter2 > parameter3. Here, parameter1, parameter2 and parameter3 are parameters of a mask.

Optional field. Specifies the error message to be displayed when the cross parameter constraint rule is not satisfied. You can specify the error message as character vector or as 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. Simulink® displays a default error message if no user-defined error message is found.

Output Arguments

expand all

Handle to the cross-parameter constraint, returned as a cell array.

Examples

% Get block mask handle.
maskObj = Simulink.Mask.get(gcb); 

% Add cross parameter constraint.
CrossConstraint = maskObj.addCrossParameterConstraint('Name','crossconstraint1',...
'MATLABexpression','upperbound > lowerbound','ErrorMessage','Incorrect value specified.')

ans = 

  CrossParameterConstraints with properties:

            Name: 'crossconstraint1'
MATLABexpression: 'upperbound > lowerbound'
    ErrorMessage: 'Incorrect value specified.'
Introduced in R2018a