addConstraint
Add constraint to variant configuration data object
Description
Add-On Required: This feature requires the Variant Manager for Simulink add-on.
addConstraint(
adds a constraint with the name varConfigData,ConstraintName=constraintName)constraintName to a Simulink.VariantConfigurationData object
varConfigData.
You can use constraints to check if all the variant configurations present in
varConfigData satisfy certain conditions. The constraint must be
specified as a valid Boolean condition expression. The expression can contain variant
control variables used in the model hierarchy, names of variant
configurations of referenced components in the hierarchy, or a combination of
these (since R2025a). Simulink® evaluates these constraints during variant configuration activation, model
compilation, simulation, and code generation workflows.
addConstraint(___,
specifies options using one or more name-value arguments in addition to the input arguments
in previous syntaxes, for example, option to set the condition expression for the new
constraint.Name=Value)
Examples
Input Arguments
Name-Value Arguments
Limitations
Variant Manager constraints are evaluated based on the values of variant control variables defined in the base workspace or data dictionaries linked to the model for which the constraint is defined.