addConstraint
Add constraint to variant configuration data object
Syntax
Description
Note
This function requires Variant Manager for Simulink®.
addConstraint(
adds a constraint with the name varConfigData
,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(___,
adds a constraint using the input arguments in previous syntax and also sets the condition
expression to condition
)condition
.
addConstraint(___,
adds a constraint along with a description of the constraint.description
)
Examples
Input 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.