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

44 ビュー (過去 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 Center および File ExchangeModeling についてさらに検索

製品

Community Treasure Hunt

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

Start Hunting!

Translated by