Modify In/Output Port names with a MATLAB script
조회 수: 4 (최근 30일)
이전 댓글 표시
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
댓글 수: 0
답변 (1개)
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
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 Center 및 File Exchange에서 Simulink Environment Customization에 대해 자세히 알아보기
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!