Modify In/Output Port names with a MATLAB script
8 次查看(过去 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!