Is it possible to autmaticly switch between referenced model and subsystem in Simulink?

3 views (last 30 days)
Suppose there is a referenced model in a top model in Simulink. Is it possible to change this model to a subsystem from command line? I can do it by "copy-paste" the content, however I need it to be done in an automatic way.

Accepted Answer

Ayush
Ayush on 5 Oct 2023
  1 Comment
Bartlomiej Stanczyk
Bartlomiej Stanczyk on 5 Oct 2023
Sorry for duplicating questions. In the meanime I have managed to extend the code provided in the answer you mentioned to work with models that involve more than one referenced model at the same level.
The whole difference in the code is to substitute the line
ref_block_path = getfullname(mdlRefsHandles);
with
ref_block_path = getfullname(mdlRefsHandles(k));

Sign in to comment.

More Answers (0)

Products


Release

R2017a

Community Treasure Hunt

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

Start Hunting!