Main Content

addConstraint

Class: Simulink.VariantConfigurationData
Package: Simulink

Add a constraint to the variant configuration data object

Syntax

vcdataObj.addConstraint(nameOfConstraint)
vcdataObj.addConstraint(nameOfConstraint,condition)
vcdataObj.addConstraint(nameOfConstraint,condition,description)

Description

vcdataObj.addConstraint(nameOfConstraint) adds a new constraint with a given name to vcdataObj.

vcdataObj.addConstraint(nameOfConstraint,condition) adds a new constraint with a given name and condition expression to vcdataObj.

vcdataObj.addConstraint(nameOfConstraint,condition,description)adds a new constraint with a given name, condition expression, and description to vcdataObj.

Input Arguments

nameOfConstraint

Name of constraint being added. Must be unique and valid MATLAB® variable name.

condition

Boolean expression that must evaluate to true. When the expression evaluates to true, it means the constraint is satisfied.

description

Text that describes the constraint.

Examples

% Define the variant configuration data object
vcdataObj = Simulink.VariantConfigurationData;

% Add a constraint named LinNotExtern
vcdataObj.addConstraint('LinNotExtern','((Ctrl~=1)...
  || (PlantLocation ~=1))','Description of the constraint')