MATLAB Examples

MATLAB System Block with Variable-Size Input and Output Signals

This example shows how to use the MATLAB System block to create Simulink® blocks with variable-size input and output signals.

It highlights two MATLAB System blocks. Both blocks use the same System object™ whose MATLAB source code you can access by clicking the "Source Code" hyperlink from the block dialog.

This System object inherits from the interface classes matlab.System and matlab.system.mixin.Propagates. The interface class matlab.System is required for all System objects. To use variable-size signals with a MATLAB System block, also inherit your System object from matlab.system.mixin.Propagates.

The System object specifies whether each output is fixed-size or variable-size. It also specifies the size, type, and complexity of each output. The output signals of the block represent the linear indices and elements of the input that conform to the condition specified in the block dialog.