Borrar filtros
Borrar filtros

Simulink: Fit to View (Space) Programmatically

24 visualizaciones (últimos 30 días)
Juan Garcia
Juan Garcia el 17 de Feb. de 2017
Comentada: Juan Garcia el 17 de Feb. de 2017
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.

Respuesta aceptada

Simon Greenwold
Simon Greenwold el 17 de Feb. de 2017
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 comentario
Juan Garcia
Juan Garcia el 17 de Feb. de 2017
Thanks! That is what I was looking for, I couldn't find any documentation about this.

Iniciar sesión para comentar.

Más respuestas (0)

Categorías

Más información sobre Code Generation en Help Center y File Exchange.

Etiquetas

Community Treasure Hunt

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

Start Hunting!

Translated by