use*_*560 5 matlab multiple-monitors matlab-figure matlab-guide
我在Windows 7 PC上使用64位的matlab R2012a(7.14.0.737).我有2台显示器.我希望能够在第二台显示器(左侧)上打开一个matlab GUI图.
在命令行打开数字那里工作正常.
h = figure( ... , 'position',[some -value on the other screen y w h)
Run Code Online (Sandbox Code Playgroud)
但是,尽管1)输入到GUI窗口属性中的正确位置值和/或2)使用代码,GUI图总是在第一个监视器上进行
set( hObject, 'position',[some -value on the other screen y w h)
Run Code Online (Sandbox Code Playgroud)
在GUI打开功能.
但是,如果我将此代码放在输出函数中就可以了.当你看到这个数字出现然后移过来时,它就会变得不那么优雅.GUI中的值按照我希望它们的方式设置.似乎只是被matlab忽略了.有任何想法吗?
我已经阅读了matlab movegui(fig, 'onscreen')在打开引导创建的数字时调用的内容.ARG.我想现在的问题是如何覆盖它,或者如何将'onscreen'设置为另一个监视器.在这方面仍然没有解决方案
这不能直接从GUIDE中完成。
解决方法
导出图形:GuideMenu -> 文件 -> 导出
更换线路:
movegui(gui_hFigure,'onscreen');
Run Code Online (Sandbox Code Playgroud)
和:
set(gcbf, 'position',[some -value on the other screen y w h)
Run Code Online (Sandbox Code Playgroud)
对于我 ( R2012a ),这显示在导出的 GUI 的第 330 行附近:
...
% 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,
...
Run Code Online (Sandbox Code Playgroud)