フィルターのクリア

Centering all subsystems inside a simulink model

6 ビュー (過去 30 日間)
Markus M.
Markus M. 2023 年 6 月 1 日
回答済み: Milan Bansal 2023 年 9 月 1 日
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?

回答 (2 件)

Harshal Ritwik
Harshal Ritwik 2023 年 6 月 13 日
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 件のコメント
Markus M.
Markus M. 2023 年 6 月 13 日
Thanks for your answer, but i don't want to center thousands of subsystems by hand. I would like to do it programmatically.

サインインしてコメントする。


Milan Bansal
Milan Bansal 2023 年 9 月 1 日
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.

カテゴリ

Help Center および File ExchangeSchedule Model Components についてさらに検索

製品


リリース

R2020a

Community Treasure Hunt

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

Start Hunting!

Translated by