Mapping System Object Code to MATLAB System Block Dialog Box
The System object™ source code controls the appearance of the block dialog box. This section maps the System object code to the block dialog box. This example code snippet uses two System objects, one that uses default System object to block dialog box mapping, and one that uses a custom mapping.
Note
You can also change the appearance of a MATLAB System block dialog box using the Mask Editor. For more information, see Customize MATLAB System Icon and Dialog Box Using Mask Editor.
System Object to Block Dialog Box Default Mapping
The following figure shows how the source code corresponds to the dialog box
elements when you do not customize the dialog using the getHeaderImpl
or getPropertyGroupsImpl
methods. (The link to open the source code and
the Simulate using parameter appear on all MATLAB
System block dialog boxes.)
The Delay block from the example model snippet uses a System object that draws the dialog box using the default mapping. This block has one input and one output.
This block uses a System object that has direct feedthrough set to false (nondirect feedthrough). This setting means that the System object does not directly use the input to compute the output, enabling the model to use this block safely in a feedback system without introducing an algebraic loop. For more information on nondirect feedthrough, see Use System Objects in Feedback Loops.
For an example of a custom block dialog box, see System Object to Block Dialog Box Custom Mapping.
System Object to Block Dialog Box Custom Mapping
The LMS Adaptive block is an example of a block with a custom
header and property groups. The System object code uses the getHeaderImpl
and
getPropertyGroupsImpl
methods from matlab.System
to customize these block dialog
elements.
The LMS Adaptive Filter block estimates the coefficients of an
unknown system (formed by the Unknown System and Delay blocks). Its inputs
are the desired signal and the actual signal. Its outputs are the estimated signal and the
vector norm of the error in the estimated coefficients. It uses the
lmsSysObj
System object.
The source code for this System object also defines two input and output ports for the block.