Why Do Simulink Subsystem Ports Sometimes Show Numbers Instead of Names?

6 views (last 30 days)
When I name Inport or Outport blocks in a subsystem as “Input” or “Output,” the subsystem icon shows port numbers instead of the names. Other names like “InputSignal” or “OutputData” display correctly.
Why does this happen, and how can I make the subsystem show the names I want?

Accepted Answer

MathWorks Support Team
MathWorks Support Team about 23 hours ago
This behavior depends on the subsystem’s ShowPortLabels setting. When this property is set to FromPortIcon, the subsystem uses the display setting of the underlying port block, which often defaults to showing the port number.
Simulink also applies rules to decide whether a block name is considered “default.” Names such as “In,” “Input,” “Out,” or “Output,” with or without numeric suffixes, are treated as default names. When a name is considered default, Simulink does not display it on the subsystem icon and instead shows the port number. If you use a non-default name, such as “InputSignal” or “OutputData,” the name will appear.
To make the subsystem displays the actual block names, you can change ShowPortLabels to FromPortBlockName. This forces the subsystem to use the block names regardless of the port icon setting. Alternatively, you can rename the ports to something other than the default names. 
set_param(gcb, 'ShowPortLabels','FromPortBlockName');

More Answers (0)

Tags

No tags entered yet.

Products


Release

R2022b

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!