How can I adapt the model editor window size and location programmatically in Simulink?

6 views (last 30 days)
I would like to open a model using the open_system command. While opening the model or right after opening how can I resize and relocate the model editor window.

Accepted Answer

MathWorks Support Team
MathWorks Support Team on 10 Jun 2016
Edited: MathWorks Support Team on 10 Jun 2016
The size and location of a Simulink model editor window can be adapted by setting the property 'Location' of the current model, e.g you can use:
open_system('vdp');
set_param(gcs,'location',[47 100 1015 633]);
The format of 'Location'is [Xposition, Yposition, Xpixels, Ypixels].
Attention, 'Location' property is for internal use. This specification may be changed in the future.
  1 Comment
Qu Cao
Qu Cao on 9 Jan 2017
You cannot use this command in startup.m since when you start MATLAB, there is no Simulink model loaded. As a workaround, you can put this command in the PostLoad Callback function of the model so that every time you load the model, its position will be set by the command.

Sign in to comment.

More Answers (0)

Products


Release

R2009a

Community Treasure Hunt

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

Start Hunting!