Main Content

propagatedInputSize

Class: matlab.System

Size of input during Simulink propagation

Syntax

size = propagatedInputSize(obj,index)

Description

size = propagatedInputSize(obj,index) returns, as a vector, the input size of the specified System object™. The index specifies the input for which to return the size information. (Do not count the obj in the index. The first input is always obj.)

You can use propagatedInputSize only from within the getOutputSizeImpl method in your class definition file. Use getOutputSizeImpl when:

  • Your System object has more than one input or output.

  • The input size determines the output size.

  • The output size must differ from the input size.

Note

For variable-size inputs, the propagated input size from propagatedInputSize differs depending on the environment.

  • MATLAB — propagatedInputSize returns the size of the inputs used when you run the object for the first time.

  • Simulink — propagatedInputSize returns the upper bound of the input sizes.

Input Arguments

expand all

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

Index of the specified input

Output Arguments

expand all

Size of the specified input, returned as a vector

Examples

expand all

Get the size of the second input. If the first dimension of the second input has a size greater than 1, then set the output size to a 1 x 2 vector. For all other cases, the output is a 2 x 1 matrix. Assume that the first input has no impact on the output size.

methods (Access = protected)
   function outsize = getOutputSizeImpl(obj)
       size = propagatedInputSize(obj,2);
       if size(1) == 1
           outsize = [1,2];
       else
           outsize = [2,1];
       end
   end 
end

See Also

Topics

Introduced in R2014a