open_system() not working with Model Reference
8 visualizaciones (últimos 30 días)
Mostrar comentarios más antiguos
Christian
el 9 de Ag. de 2023
Hello,
I am using Simulink R2022b.
Currently I am trying to use the open_system() in the Command Window for a top level model that references other models using the Block "Model" from Simulink/Ports&Subsystems library.
However using :
open_system('TOP_LEVELSystem/Model (NAME_REF_MODEL)/SubsystemXYZ')
does not work because in the top level system it only identifies 'TOP_LEVELSystem/Model' as a block, but nothing below that.
Is there any workaround ? Thank you very much !
0 comentarios
Respuesta aceptada
Fangjun Jiang
el 10 de Ag. de 2023
You need to get the name of the referenced model first and then open the model separately.
RefModel=get_param('TOP_LEVELSystem/Model','ModelName');
open_system(ModelName);
open_system(fullfile(ModelName,'SubsystemXYZ'))
1 comentario
Más respuestas (1)
Sara Nadeau
el 11 de Ag. de 2023
If you want to open the model within the context of the model hierarchy, you can create a Simulink.BlockPath object and then use the open function to open the model to the location specified in the Simulink.BlockPath object.
The example on this page shows how to do this: https://www.mathworks.com/help/simulink/slref/simulink.blockpath.open.html
1 comentario
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!