Main Content

Change Block Icon and Port Labels

You can customize the MATLAB System icon and dialog box.


From R2023b, you can use the Mask Editor to design a MATLAB System icon and dialog box. You can also migrate existing mask customizations to the Mask Editor. This capability eliminates the need to develop or maintain methods in a System object™ file. For more information, see Customize MATLAB System Icon and Dialog Box Using Mask Editor.

To change the icon appearance of your block, you must add specific methods to your System object. For example, to define port labels, implement getInputNamesImpl and getOutputNamesImpl.

  1. To define the icon, implement the getIconImpl method.

  2. To define the port labels, implement getInputNamesImpl to change the input and getOutputNamesImpl to change the output port labels.

If you do not implement these methods, by default the System object uses the input and output port names from the stepImpl method. If you are using nondirect feedthrough, by default the System object uses the input names from updateImpl and the output port names from outputImpl.

Modify MATLAB System Block Dialog

You can change the MATLAB System block dialog in two ways.

Change the MATLAB System Block Icon to an Image

You can change the image of MATLAB System block in MATLAB® Editor. For a list of accepted image files, see image. To use an existing image file for the MATLAB System block:

  1. Double-click your MATLAB System block.

  2. In the block dialog box, click the Source code. The MATLAB Editor that contains the System object code opens.

  3. In the MATLAB Editor, from the System Block drop-down list, select Add Image Icon.

  4. In the Add image icon dialog window, click Browse to select an image of your choice.

  5. Click OK to insert the corresponding code for the getIconImpl method in your System object.

For more information, see Customize System Block Appearance Programmatically.

See Also



Related Topics