Centering all subsystems inside a simulink model

2 views (last 30 days)
Hello,
my goal is to center all views inside every subsystem (including masked and linked subsystems) inside a large simulink model.
I found this answer from 2019: Answers/438327 from the MathWorks Support Team, however this does not seem to work that well because:
  • It takes extremely long, due to opening each and every subsystem inside my model
  • Its not consistent: Not every block's ZoomFactor gets set to 100%.
  • After assigning a ZoomFactor of 100% to a block, some ZoomFactors get reset after opening a block inside simulink
Is there a better way of centering every subsystem now?

Answers (2)

Harshal Ritwik
Harshal Ritwik on 13 Jun 2023
Hi,
As per my understanding of your question you want to know how we can use display the subsystems with 100 percent zoom and centre them.
You can use the spacebar when you need to centre the subsystem and maximize its zoom factor. You can press the spacebar once you have opened the model.
I hope it helps!
Thanks.
  1 Comment
Markus M.
Markus M. on 13 Jun 2023
Thanks for your answer, but i don't want to center thousands of subsystems by hand. I would like to do it programmatically.

Sign in to comment.


Milan Bansal
Milan Bansal on 1 Sep 2023
Hi,
I understand that you need to display your whole model as well as all the subsystems inside it at the centre and with 100% zoom.
Try to run the code given below. It will recenter the model and all its subsytems and fit them to screen.
load_system('model_name')
Sys = find_system("model_name")
set_param( Sys{1}, 'ZoomFactor', 'FitSystem' ); % recenter and fit the model to screen
subSystems = find_system("randomTest",'BlockType', 'SubSystem'); % list of all the subsystems present in the model
for ind=1:length(subSystems)
set_param( subSystems{ind}, 'ZoomFactor', 'FitSystem' ); % recenter and fit the subsystem to screen
end
Refer to the link below to know more about "find_system" command.

Categories

Find more on Schedule Model Components in Help Center and File Exchange

Products


Release

R2020a

Community Treasure Hunt

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

Start Hunting!