This is machine translation

Translated by Microsoft
Mouseover text to see original. Click the button below to return to the English version of the page.

Note: This page has been translated by MathWorks. Click here to see
To view all translated materials including this page, select Country from the country navigator on the bottom of this page.

Advisor.authoring.CompositeConstraint class

Package: Advisor.authoring

Create a Model Advisor constraint that checks for multiple constraints


Instances of Advisor.authoring.CompositeConstraint class contain multiple constraints. Depending on the instance definition, the Model Advisor reports a violation if a model does not meet one or all of the constraints.


cc = Advisor.authoring.CompositeConstraint creates an instance of this class


expand all

IDs of constraints that compose an Advisor.authoring.CompositeConstraint object. This property is read-only. Use the addConstraintID method to create a CompositeConstraint.

Use and operator to specify that the Model Advisor reports a violation if a model does not meet all of the check constraints. Use or operator to specify that the Model Advisor reports a violation if a model does not meet at least one of the check constraints. This property is read/write.


addConstraintID Add constraint to composite constraint


collapse all

These commands specify a composite constraint for Multi-Port Switch blocks.

Create three PositiveBlockParameter constraint objects.

c1 = Advisor.authoring.PositiveBlockParameterConstraint(); 
c1.ID = 'ID_A2'; 
c1.BlockType = 'MultiPortSwitch'; 
c1.ParameterName = 'DataPortOrder'; 
c1.SupportedParameterValues = {'Specify indices'}; 
c1.ValueOperator = 'eq'; 

c2 = Advisor.authoring.PositiveBlockParameterConstraint(); 
c2.ID = 'ID_A3'; 
c2.BlockType = 'MultiPortSwitch'; 
c2.ParameterName = 'DataPortForDefault'; 
c2.SupportedParameterValues = {'Additional data port'}; 
c2.ValueOperator = 'eq'; 

c3 = Advisor.authoring.PositiveBlockParameterConstraint(); 
c3.ID = 'ID_A4'; 
c3.BlockType = 'MultiPortSwitch'; 
c3.ParameterName = 'DiagnosticForDefault'; 
c3.SupportedParameterValues = {'None'}; 
c3.ValueOperator = 'eq'; 

Use the addPreRequisiteConstraintID method to make c1 a prerequisite to checking constraints c2 and c3.


Create a composite constraint that specifies that if a Rate Transition block does not meet both constraints c2 and c3, the block is in violation of this check.

CC = Advisor.authoring.CompositeConstraint(); 
CC.CompositeOperator = 'and'; 

Introduced in R2018a