How do I force subsystems in a library to open in the same window in R2012a?

6 views (last 30 days)
I am working with a large Simulink model in R2012a. I want to navigate the model in a single model window. In my Simulink preferences, I have set "Window reuse" to "reuse", which seems to work for models, but not libraries. That is, when I double-click on a subsystem in a model, the subsystem opens in the same window; but when I double-click on a subsystem in a library, the subsystem opens in a new window.
Is there a way to force Simulink to reuse windows when navigating both models and libraries?
On a related note, I sometimes open subsystems programmatically, and in these cases, I would also like to reuse the current window. If I know what subsystem is currently open in the window I can use the syntax:
% open 'f14' into the 'f14/Controller' window in 'reuse' mode
open_system('f14','f14/Controller','reuse');
But how can I find out--programmatically--which subsystem is currently open? For example, if the window is currently in 'f14/Nz pilot\ncalculation/Pilot\ng force (g)', the command above will fail:
Invalid system for 'replace' with OPEN_SYSTEM
If there is only one model open, then it is sufficient to use gcs:
open_system('f14', gcs, 'reuse');
But suppose I have two models open, and the current system is not in the same model as the one I want to open. Then Simulink complains:
The current system must be in the same hierarchy as the system being opened when reusing windows
I could verify that the model is open using
bdLoaded = find_system('Type', 'block_diagram');
But how would I check which subsystem is currently displayed in a model window for a model other than the current system?
  1 Comment
Vidya Viswanathan
Vidya Viswanathan on 30 Aug 2016
The Window Reuse option in Simulink Preferences does not work with Simulink libraries. However, there is a programmatic approach to enable this:
set_param(0, 'WindowReuseForLibraries', 'reuse')

Sign in to comment.

Answers (0)

Categories

Find more on Programmatic Model Editing in Help Center and File Exchange

Products

Community Treasure Hunt

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

Start Hunting!