How to open and close all tabs of a Simulink model programmatically?
21 Ansichten (letzte 30 Tage)
Ältere Kommentare anzeigen
MathWorks Support Team
am 19 Okt. 2022
Beantwortet: MathWorks Support Team
am 19 Okt. 2022
How can I open/close all the tabs (have only the main model window open) of a Simulink model programmatically with the "open_system" and "load_system" commands?
Akzeptierte Antwort
MathWorks Support Team
am 19 Okt. 2022
The "load_system" function loads a Simulink model, without opening any previously opened subsystem or model tabs.
>> sys = load_system('<model>');
>> set_param(sys, 'Open', 'on');
To close subsystem or model tabs in a currently open model, execute the following commands:
>> sys_name = '<model>';
>> sys = find_system(sys_name);
>> subsys = find_system(sys,'BlockType','SubSystem');
>> close_system(subsys);
>> [mdl,~] = find_mdlrefs(sys_name);
>> idx = (strcmp(mdl,sys_name)~=1);
>> close_system(mdl(idx));
0 Kommentare
Weitere Antworten (0)
Siehe auch
Kategorien
Mehr zu Programmatic Model Editing finden Sie in Help Center und File Exchange
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!