This is machine translation

Translated by Microsoft
Mouseover text to see original. Click the button below to return to the English verison of the page.

Note: This page has been translated by MathWorks. Please click here
To view all translated materals including this page, select Japan from the country navigator on the bottom of this page.


Class: matlab.system.mixin.Propagates
Package: matlab.system.mixin

Sizes of output ports


[sz_1,sz_2,...,sz_n] = getOutputSizeImpl(obj)


[sz_1,sz_2,...,sz_n] = getOutputSizeImpl(obj) returns the size of each output port. The number of outputs must match the value returned from the getNumOutputs method or the number of output arguments listed in the stepImpl method.

For System objects with one input and one output and where you want the input and output sizes to be the same, you do not need to implement this method. In this case getOutputSizeImpl assumes the input and output sizes are the same and returns the size of the input. For variable-size inputs in MATLAB®, the size varies each time you run your object. For variable-size inputs in Simulink®, the output size is the maximum input size.

If your System object has more than one input or output or you need the output and input sizes to be different, you must implement the getOutputSizeImpl method to define the output size. You also must use the propagatedInputSize method if the output size differs from the input size.

During Simulink model compilation and propagation, the MATLAB System block calls the getOutputSize method, which then calls the getOutputSizeImpl method to determine the output size.

All inputs default to variable-size inputs For these inputs, the output size is the maximum input size.

    Note:   You must set Access = protected for this method.

    You cannot modify any properties in this method.

Input Arguments


System object™ handle

Output Arguments


Vector containing the size of each output port.


expand all

Specify in your class definition file the size of a System object output.

methods (Access = protected)
   function sz_1 = getOutputSizeImpl(obj)
      sz_1 = [1 1];

Specify in your class definition file the sizes of multiple System object outputs.

methods (Access = protected)
   function [sz_1,sz_2] = getOutputSizeImpl(obj) 
      sz_1 = propagatedInputSize(obj,1); 
      sz_2 = [1 1]; 

Specify in your class definition file the size of System object output when it is dependant on the propagated input size.

methods (Access = protected)
   function varargout = getOutputSizeImpl(obj) 
      varargout{1} = propagatedInputSize(obj,1); 
      if obj.HasSecondOutput
         varargout{2} = [1 1];
Was this topic helpful?