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

조회 수: 6 (최근 30일)
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?

채택된 답변

MathWorks Support Team
MathWorks Support Team 2025년 12월 16일 0:00
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');

추가 답변 (0개)

카테고리

Help CenterFile Exchange에서 Subsystems에 대해 자세히 알아보기

태그

아직 태그를 입력하지 않았습니다.

제품


릴리스

R2022b

Community Treasure Hunt

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

Start Hunting!

Translated by