필터 지우기
필터 지우기

Simulink: Fit to View (Space) Programmatically

조회 수: 24 (최근 30일)
Juan Garcia
Juan Garcia 2017년 2월 17일
댓글: Juan Garcia 2017년 2월 17일
Hi everyone,
I developed my own utility to handle my Simulink models and I would like to execute the Fit to View command (Space shortcut in Simulink) when opening the models programmatically. Is there a way to do that with a MATLAB command or using a Java Robot is the only way right now?
(In case someone is interested in implementing this with Java:)
% Create Java Robot
jRobot = java.awt.Robot;
% Fit Simulink to View with jRobot
jRobot.keyPress(java.awt.event.KeyEvent.VK_SPACE);
jRobot.keyRelease(java.awt.event.KeyEvent.VK_SPACE);
Thanks in advance.

채택된 답변

Simon Greenwold
Simon Greenwold 2017년 2월 17일
Actually, you can do this with set_param.
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')
  댓글 수: 1
Juan Garcia
Juan Garcia 2017년 2월 17일
Thanks! That is what I was looking for, I couldn't find any documentation about this.

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

추가 답변 (0개)

카테고리

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

태그

Community Treasure Hunt

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

Start Hunting!

Translated by