Main Content

getOutputDimensionConstraintImpl

Class: matlab.System

Define output dimension constraints for dataflow subsystems

Syntax

constraints = getOutputDimensionConstraintImpl(obj)
constraints = getOutputDimensionConstraintImpl(obj,index)

Description

constraints = getOutputDimensionConstraintImpl(obj) defines the output dimension constraint for the first output.

constraints = getOutputDimensionConstraintImpl(obj,index) defines the output dimension constraint for the indexth output port.

Method Authoring Tips

  • You must set Access = protected for this method.

  • If you specify the getOutputDimensionConstraintImpl method, you should also specify the getInputDimensionConstraintImpl method.

Input Arguments

expand all

System object handle used to access properties, states, and methods specific to the object. If your getOutputDimensionConstraintImpl method does not use the object, you can replace this input with ~.

Index of output port, specified as a scalar integer.

Output Arguments

expand all

The output dimension constraint object, used by dataflow to optimize the automatic partitioning of a dataflow subsystem for multithreaded simulation and code generation.

Use the outputDimensionConstraint method to specify the 'MinimumSize' property of the dimension constraint object. 'MinimumSize' defines the minimum number of samples needed to run, specified as a nonnegative scalar integer. This value is used for downstream automatic frame-size calculation in dataflow subsystems.

Examples

expand all

Specify the required output dimension of the first input of a system object.

function dc = getOutputDimensionConstraintImpl(obj)
    dc = outputDimensionConstraint(obj, 'MinimumSize', obj.NumBins);
end

To specify the output dimension for an input port other than the first input port, specify the port index in the constructor.

function dc = getOutputDimensionConstraintImpl(obj, index)
    if index == 1
        dc = outputDimensionConstraint(obj, 'MinimumSize', obj.NumBins);
    else
        dc = outputDimensionConstraint(obj, 'MinimumSize', 1);
    end
end

Default Behavior

If this method is not overwritten, the MATLAB System block sets the output dimension constraint to unspecified. The unspecified setting allows the dataflow scheduler to make conservative assumptions for optimization.

Version History

Introduced in R2018b