addParameterConstraint
Class:Simulink.Mask
Package:万博1manbetx
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编辑type mask parameters.paramConstraint
=maskObj
.addParameterConstraint(Name,Value
)
Input Arguments
Output Arguments
Examples
Create Mask Constraint with Single Rule
% Get block mask handle.maskObj = Simulink.Mask.get(gcb);% Create mask constraint with single rule.paramConstraint = maskObj.addParameterConstraint('Name','const2',...'Parameters',{'参数2'},'Rules', {'DataType',“uint8”})
ans = Constraints with properties: Name: 'const2' ConstraintRules: [1×1 Simulink.Mask.ParameterConstraintRules]
Create Mask Constraint with Multiple Rules
% Get block mask handle.maskObj = Simulink.Mask.get(gcb);% Create mask constraint with multiple rules.paramConstraint = maskObj.addParameterConstraint('Name','const3',...'Parameters',{'Parameter3'},'Rules', {{'DataType',“uint8”},{'DataType', {'fixdt(1,8,4)'}}})
ans = Constraints with properties: Name: 'const3' ConstraintRules: [1×2 Simulink.Mask.ParameterConstraintRules]