Main Content

getInputDimensionConstraintImpl

Class: matlab.System

Define input dimension constraints for dataflow subsystems

Syntax

constraints = getInputDimensionConstraintImpl(obj)
constraints = getInputDimensionConstraintImpl(obj,index)

Description

constraints = getInputDimensionConstraintImpl(obj) defines the input dimension constraint for the first input.

constraints = getInputDimensionConstraintImpl(obj,index) defines the input dimension constraint for obj for the indexth input port.

Method Authoring Tips

  • You must set Access = protected for this method.

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

Input Arguments

expand all

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

Index of input port, specified as a scalar integer.

Output Arguments

expand all

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

Use the inputDimensionConstraint method to specify the following properties of the dimension constraint object.

  • 'MinimumSize' - Minimum number of samples needed to run, specified as a nonnegative scalar integer.

  • 'Concatenable' - Whether the object can accept multiples of the minimum size, specified as a boolean. The default value for 'Concatenable' is false.

    If 'Concatenable' is set to true, the software may buffer the inputs to the System object. If 'Concatenable' is set to false, the software may execute the block several times to process all of the incoming data.

Examples

expand all

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

function dc = getInputDimensionConstraintImpl(obj)
    dc = inputDimensionConstraint(obj, 'MinimumSize', obj.NumBins, 'Concatenable', true);
end

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

function dc = getInputDimensionConstraintImpl(obj, index)
    if index == 1
        dc = inputDimensionConstraint(obj, 'MinimumSize', obj.NumBins, 'Concatenable', true);
    else
        dc = inputDimensionConstraint(obj, 'MinimumSize', 1, 'Concatenable', true);
    end
end

Default Behavior

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

Introduced in R2018b