How to open and close all tabs of a Simulink model programmatically?
25 visualizaciones (últimos 30 días)
Mostrar comentarios más antiguos
MathWorks Support Team
el 19 de Oct. de 2022
Respondida: MathWorks Support Team
el 19 de Oct. de 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?
Respuesta aceptada
MathWorks Support Team
el 19 de Oct. de 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 comentarios
Más respuestas (0)
Ver también
Categorías
Más información sobre Programmatic Model Editing en Help Center y File Exchange.
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!