禁止Matlab窗口焦点窃取 [英] Inhibit Matlab Window Focus Stealing

查看:232
本文介绍了禁止Matlab窗口焦点窃取的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

有没有办法通过图形命令(如 figure )来告诉Matlab not 窃取窗口焦点(来自外部编辑器,如Emacs) >和绘图。这会提高我的工作效率,因为我经常希望在数据(重新)处理过程中继续进行代码开发。 解决方案

可能的,诀窍是不使用数字声明,而是直接改变当前数字。这将改变活动情节而不改变焦点。通常情况下,我会这样做:
$ b $ $ $ $ $ $ $ $ $ $ $ $ $ $ $ $ $ $ $ $ $ $ $ $ $ $ $ $ $ $'$'然后,所有的图(h)语句都需要更改为change_curent_figure(h)。



$ b

/ p>

请注意,这包含在 matlab文档。



值得注意的是,这只有在图形已经创建时才有效。如果要定期创建新数字,可以将数字作为前几行代码,保存句柄,进行处理,然后对其进行绘图。这个例子可以工作。注意,drawnow命令将刷新事件缓冲区,确保所有的数据都被绘制出来。



我从2007 - 2010年看过这个工作,不知道最新的还是以前的版本支持这个,虽然我没有理由怀疑他们没有。

  fig1 = figure; 
fig2 = figure;
drawnow;
[a b] = do_complex_processing;
change_current_figure(fig1)
plot(a);
change_current_figure(fig2)
plot(b);


Is there a way to tell Matlab not to steal window focus (from an external editor) such as Emacs) upon graphical commands such as figure and plot. This would increase my productivity a lot because I often want to continue code development during data (re-)processing.

解决方案

It is possible, the trick is to not use the figure statement, but to change the current figure directly. This will change the active plot without changing the focus. Typically I do something like this:

function change_current_figure(h)
set(0,'CurrentFigure',h)

Then, all of the figure(h) statements need to be changed to change_curent_figure(h).

Note, this is included in the matlab documentation.

It should be noted, this only works if the figure is already created. If new figures are going to be periodically created, one could create the figures as the very first few lines of code, save the handles, do the processing, and then plot to them. This example would work. Note, the drawnow command will flush the event buffer, making sure all figures are plotted.

I've seen this work from 2007-2010, not sure if the latest or earlier versions support this, although I have no reason to suspect they don't.

fig1=figure;
fig2=figure;
drawnow;
[a b]=do_complex_processing;
change_current_figure(fig1)
plot(a);
change_current_figure(fig2)
plot(b);

这篇关于禁止Matlab窗口焦点窃取的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆