Modify In/Output Port names with a MATLAB script

조회 수: 4 (최근 30일)
Gennaro Di Sarno
Gennaro Di Sarno 2023년 3월 2일
댓글: ciming zhu 2023년 4월 27일
Hi,
I have a simulink subsytem with a huge number of input and output ports, I need to rename all the ports names according to an excel file list.
I'd like to avoid doing it manually but I have no clue on how to write down a MATLAB script to automatically do it.
Kind Regards

답변 (1개)

Fangjun Jiang
Fangjun Jiang 2023년 3월 3일
편집: Fangjun Jiang 2023년 3월 3일
Something like this:
[~,~,InPortNames]=xlsread('ExcelFileName'); % read Excel file to get PortNames as a cell array
InPorts=find_system('Model/Subsystem','SearchDepth',1,'BlockType','Inport');
for k=1:length(InPorts)
set_param(InPorts{k},'Name',InPortNames{k});
end
  댓글 수: 1
ciming zhu
ciming zhu 2023년 4월 27일
Could you please show me how to achieve this proceed in multibody?It seems that there is no Inport in multibody.Thanks a lot.

댓글을 달려면 로그인하십시오.

카테고리

Help CenterFile Exchange에서 Simulink Environment Customization에 대해 자세히 알아보기

제품


릴리스

R2017b

Community Treasure Hunt

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

Start Hunting!

Translated by