GUI图不能在双显示器上打开,但其他数字还可以

时间:2012-12-05 01:48:28

标签: matlab matlab-figure matlab-guide multiple-monitors

我在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)

但GUI图总是在第一台显示器上进行,尽管1)输入到GUI窗口属性中的正确位置值和/或2)使用代码

set( hObject, 'position',[some -value on the other screen y w h)

在GUI打开功能中。

但是,如果我将此代码放在输出函数中,那就没关系。当你看到这个数字出现然后移动时,你会看起来不那么优雅。 GUI中的值按照我希望它们的方式设置。似乎只是被matlab忽略了。有什么想法吗?

  • 更新*

我已经读过matlab在打开引导创建的数字时调用movegui(fig, 'onscreen')。 ARG。我想现在的问题是如何覆盖它,或者如何将'onscreen'设置为另一个监视器。在这方面仍然没有解决方案

2 个答案:

答案 0 :(得分:0)

您会注意到matlab中的GUIDE GUI有几个默认函数,在打开时会自动调用。 matlab的一个令人讨厌的功能是,这些功能中至少有两个会覆盖您的默认数字定位。也许可以修改此处讨论的解决方案之一here以解决您的问题。

答案 1 :(得分:0)

这不能直接在 GUIDE 中完成。

解决方法

导出你的数字: GuideMenu - >档案 - >导出

替换行:

movegui(gui_hFigure,'onscreen');

with:

set(gcbf, 'position',[some -value on the other screen y w h)

对我来说( 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, 
...