- Right-click on your subsystem and navigate to Mask > Create Mask
- In the "Icon" tab, the changes you make will be reflected on the subsystem mask.
- "port_label" is the function with which you can dynamically set the port labels - https://www.mathworks.com/help/simulink/slref/port_label.html.
- "color" is the function with which you can set the colour of the objects being rendered on the mask - https://www.mathworks.com/help/simulink/slref/color.html
How can I create a dynamic output port name that updates based on an action and change output text color using system object?
6 views (last 30 days)
Show older comments
Looking at the image below, how can I turn the output port name to red instead of the default black color using system object? How can I update the port name to what the user has selected? For example, instead of 'NC', if the user select 3, I want to change the output port name to I3 with the color black. Thanks.

2 Comments
Raghava S N
on 7 Apr 2025
You can make use of a mask for the subsystem through which you can set the colour and value of the output port label.
For more information about subsystem masks and the mask editor, you may refer this link - https://www.mathworks.com/help/simulink/gui/mask-editor-overview.html
Hope that solves your query!
Answers (1)
colordepth
on 17 Apr 2025
Edited: colordepth
on 17 Apr 2025
As of MATLAB R2024b, there doesn't appear to be a built-in method to accomplish this using system objects. Moreover, attempting to modify the block mask programmatically results in an error, as illustrated below:

The only way to change the icon (including port labels and colors) for blocks using system objects is by using the mask editor. The steps suggested by @Raghava S N work well to achieve such customization.
Additional information: When you save a system object mask from the mask editor, it is serialized as an XML file in the same directory as your system object M-file. This means that both the system object and its mask customization code are accessible in one folder location, as shown below. However, any changes must be made through the mask editor.

0 Comments
See Also
Categories
Find more on Create Block Masks in Help Center and File Exchange
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!