Zoom and center Simulink model program (alt+1 & spacebar)

조회 수: 14 (최근 30일)
Richard Hopple
Richard Hopple 2016년 5월 16일
댓글: Simon Greenwold 2017년 2월 17일
Trying to program the same functionality as you see in the "alt+1" and "spacebar" shortcuts into a callback function that will run when you open a model. The best I have found is the Simulink.scrollToVisible function but that doesn't seem to always zoom to 100% and center the models.
  댓글 수: 2
Gautam
Gautam 2016년 5월 23일
Hi Richard,
There's a 'Fit to View' option in the Explorer Bar(the bar that appears on the left hand side of the Simulink model). It essentially performs the same function as 'alt+1' and 'Spacebar' shortcuts.
Richard Hopple
Richard Hopple 2016년 6월 6일
Gautam
Yea, I saw that but that doesn't actually help me. I need to program this into a starting script for when open a model

댓글을 달려면 로그인하십시오.

채택된 답변

James
James 2016년 9월 6일
Hi Richard,
You can set the Simulink window's view using the system's 'Zoomfactor' parameter. For example:
set_param(gcs,'Zoomfactor','fit to view')
will zoom and centre the current Simulink system as the spacebar does.
  댓글 수: 1
Simon Greenwold
Simon Greenwold 2017년 2월 17일
You can either fit the entire system with
set_param(gcs, 'ZoomFactor','FitSystem')
or just what's currently selected with
set_param(gcs, 'ZoomFactor','FitSelection')

댓글을 달려면 로그인하십시오.

추가 답변 (0개)

카테고리

Help CenterFile Exchange에서 Modeling에 대해 자세히 알아보기

제품

Community Treasure Hunt

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

Start Hunting!

Translated by