フィルターのクリア

How to add multiple "display" block to multiple subsystems in a simulink file programmatically

4 ビュー (過去 30 日間)
MANIKANDAN S
MANIKANDAN S 2023 年 12 月 9 日
回答済み: Fangjun Jiang 2023 年 12 月 9 日
Problem statement: I have 500 of subsystem in a simulation file. I need to add display block in simulink to all subsystems. Manually doing it is taking lot of time. Is there is any method is there to script it automatically?
I have tried with following code, it is working correctly with one subssytem
"add_block('simulink/Sinks/Display','simulation path of one subsystem')
add_line('simulation path of one subsystem','Display/1','autorouting','on')
But if I use same code for all subsystems means once again declaring path of all subsystems is time consuming. Is there is any other ways is there?

回答 (1 件)

Fangjun Jiang
Fangjun Jiang 2023 年 12 月 9 日
Yes you can do it programmingly. see help for find_system() and do something like this:
AllSys=find_system(ModelName, 'SearchDepth',1,'BlockType','Subsystem')
for k=1:numel(AllSys)
add_block(...)
end

カテゴリ

Help Center および File ExchangeProgrammatic Model Editing についてさらに検索

Community Treasure Hunt

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

Start Hunting!

Translated by