Main Content

Advisor.authoring.PositiveBlockParameterConstraint Class

Namespace: Advisor.authoring
Superclasses:

Create a Model Advisor constraint to check for supported block parameter values

Description

Instances of Advisor.authoring.PositiveBlockParameterConstraint class define supported values for a specified block parameter.

Construction

constraint = Advisor.authoring.PositiveBlockParameterConstraint creates an instance of this class.

Properties

expand all

Unique identifier for the positive block parameter constraint. This property is read/write.

Block that contains the parameter for which you are specifying a constraint. For a list of block types, see Programmatically Specify Block Parameters and Properties. This property is read/write.

Block parameter for which you are specifying a constraint. For a list of block parameters, see Programmatically Specify Block Parameters and Properties. This property is read/write.

List of supported values for the block parameter specified by the BlockType and ParameterName fields. This property is read/write.

Use these operators to specify one or more supported values:

  • 'eq'

  • 'or'

  • 'lt'

  • 'gt'

  • 'ge'

  • 'le'

  • 'range'

  • 'regex'

This property is read/write. For more information on the regex operator, see regexp.

IDs of constraints that you specify as prerequisites by using the addPreRequisiteConstraintID method. If a prerequisite is not satisfied, the Model Advisor does not check the constraint that has the prerequisite. This property is read-only.

Example

Specify Supported Block Parameter Values

For a Constant block, these commands specify that the Value parameter must have a value of [2 5].

c1=Advisor.authoring.PositiveBlockParameterConstraint;
c1.ID='ID_1';
c1.BlockType='Constant';
c1.ParameterName='Value';
c1.SupportedParameterValues={'[2 5]'};
c1.ValueOperator='eq';

For a Constant block, these commands specify that the Value parameter must have a value between 1 and 4.

c1=Advisor.authoring.PositiveBlockParameterConstraint;
c1.ID='ID_1';
c1.BlockType='Constant';
c1.ParameterName='Value';
c1.SupportedParameterValues={'1','4'};
c1.ValueOperator='range';

Version History

Introduced in R2018a