I am using matlab R2012a (7.14.0.737) 64-bit on a windows 7 PC. I have 2 monitors. I want to be able to open a matlab GUI figure up on the 2nd monitor (on the left).
at the command line opening figures there works fine.
h = figure( ... , 'position',[some -value on the other screen y w h)
but the GUI figure is always made on the 1st monitor despite 1) the correct position values entered into the GUI window properties and/or 2) using the code
set( hObject, 'position',[some -value on the other screen y w h)
in the GUI opening function.
However, if I place this code in the output function it's ok. inelegant as you see the figure appear and then move over. the values in the GUI are set the way i want them to be too. just ignored by matlab it seems. Any ideas?
I have since read that matlab calls movegui(fig, 'onscreen')
when opening a guide-created figure. arg. I suppose now the issue is how to override that, or how to set 'onscreen' to be the other monitor. Still no solution on this end
This cannot be done directly from within GUIDE.
Workaround
Export your figure: GuideMenu -> File -> Export
Replace the line:
movegui(gui_hFigure,'onscreen');
with:
set(gcbf, 'position',[some -value on the other screen y w h)
For me (R2012a), this shows up around line 330 of the exported GUI:
...
% openfig (called by local_openfig below) does this for guis without
% the LayoutFcn. Be sure to do it here so guis show up on screen.
movegui(gui_hFigure,'onscreen'); %% COMMENT OUT OR REPLACE THIS LINE
else
gui_hFigure = local_openfig(gui_State.gui_Name,
...