필터 지우기
필터 지우기

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 CenterFile Exchange에서 Schedule Model Components에 대해 자세히 알아보기

제품


릴리스

R2020a

Community Treasure Hunt

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

Start Hunting!

Translated by