Modify In/Output Port names with a MATLAB script

5 ビュー (過去 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 Center および File ExchangeSimulink Environment Customization についてさらに検索

製品


リリース

R2017b

Community Treasure Hunt

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

Start Hunting!

Translated by