0

Is there any way to resize the MATLAB IDE using MATLAB code? I want to be able to maximize the window or have it take up half the screen from a script. This is on a Windows machine.

I can probably call out to an external program like AutoHotkey to do it, but am wondering if there is a native way.

Rich C
  • 3,164
  • 6
  • 26
  • 37
  • The first half of the oldest answer in the duplicate question should do what you want. – rayryeng Sep 18 '15 at 17:34
  • I want to resize the actual MATLAB IDE window (editor, command window, workspace window, etc), not a user generated GUI. How do I do that? set(0,'Position', [1 1 1000 1000]) does not work. – Rich C Sep 18 '15 at 17:52
  • Ah shoot I'm sorry. I misread your question. A visit to `java.awt.Robot` may be useful. Let me have a look and I'll write an answer. – rayryeng Sep 18 '15 at 17:59
  • 1
    I can't mark another duplicate, but try Luis Mendo's answer here: http://stackoverflow.com/a/31281037/3250829 . You're using Windows so this should work. It exploits using the `java.awt.Robot` class and programatically maximizes the window in focus. – rayryeng Sep 18 '15 at 18:03
  • Robot seems pretty cool. Might be useful. I'm thinking of doing something along the lines of this http://undocumentedmatlab.com/blog/setting-the-matlab-desktop-layout-programmatically – Rich C Sep 18 '15 at 18:08
  • Ah, that could work! Let me know how it goes. – rayryeng Sep 18 '15 at 18:11

1 Answers1

0

You can do this using a handle to the desktop:

desktop = com.mathworks.mde.desk.MLDesktop.getInstance;
desktop.getMainFrame.setSize(1200, 1000)
desktop.getMainFrame.setLocation(0, 0)
Rich C
  • 3,164
  • 6
  • 26
  • 37