Main Content

removeCrossPortParameterConstraint

Class: Simulink.Mask
Namespace: Simulink

Remove cross port parameter constraint

Since R2025a

Syntax

maskObj.removeCrossPortParameterConstraint(consName)

Description

maskObj.removeCrossPortParameterConstraint(consName) removes a cross port parameter constraint wit the name consName from the mask object maskObj. If the cross port parameter constraint does not exist, the software returns an error.

Input Arguments

expand all

Name of the cross port parameter constraint, specified as a character vector or string scalar.

Example: maskObj.removeCrossPortParameterConstraint("myconstraint")

Data Types: char | string

Examples

Remove Cross Port Parameter Constraints

Load the model and get the mask object.

model = "slexMaskingBasic.slx";
load_system(model);
maskObj = Simulink.Mask.get("slexMaskingBasic/mx + b");

Create a mask parameter Speed and Torque.

maskObj.addParameter(Name="Speed",Type="edit");
maskObj.addParameter(Name="Torque",Type="edit");

Create port identifiers for the ports.

maskObj.addPortIdentifier(Name="Input_1",Type="Input",IdentifierType="index",Identifier="1");
maskObj.addPortIdentifier(Name="Output_1",Type="Output",IdentifierType="index",Identifier="2");

Add cross port parameter constraint CheckDatatype.

maskObj.addCrossPortParameterConstraint(...
    Name="CheckDatatype", ...
    Rule="SameDataType", ...
    Associations = {'Parameters', {'Torque'}, 'PortIdentifiers', {'Input_1','Output_1'}}, ...
    DiagnosticLevel='error', ...
    DiagnosticMessage="The input port and parameter must be of the same datatype");

Add cross port parameter constraints CheckDimension.

maskObj.addCrossPortParameterConstraint(...
    Name='CheckDimension', ...
    Rule='SameDimension', ...
    Associations = {'Parameters', {'Speed'}, 'PortIdentifiers', {'Input_1','Output_1'}}, ...
    DiagnosticLevel='error', ...
    DiagnosticMessage="The input port and parameter must be of same dimension");

Remove cross port parameter constraint CheckDimension.

% maskObj.removeCrossPortParameterConstraint("CheckDimension")
% maskObj.getCrossPortParameterConstraint("CheckDimension")

Remove all the cross port parameter constraints available on the mask object.

% maskObj.removeAllCrossPortParameterConstraints
% maskObj.getCrossPortParameterConstraint("CheckDatatype")

Alternatives

You can also create cross port parameter constraint from the Mask Editor.

Version History

Introduced in R2025a