禁止MATLAB自动对焦 [英] Disallow MATLAB to take focus automatically
问题描述
我遇到以下问题:在我的MATLAB代码中,我使用了
I have the following problem: in my MATLAB code I use statements like
figure(1)
更改某些数据的目标数字.问题在于,在此MATLAB之后,系统将重点放在带有该图的窗口上.
to change destination figure for some data. The problem is that after this MATLAB take system focus on the window with this figure.
当我在后台运行一个大脚本并尝试在计算机上执行其他操作时,MATLAB始终会集中精力,而我却无法正常执行某些操作.
When I run a big script in the background and try to do something else on my computer, MATLAB always takes focus and I can't do something normally.
有没有一种方法可以禁止MATLAB执行此操作?我正在Linux Ubuntu中工作.
Is there a way to disallow MATLAB to do this? I'm working in Linux Ubuntu.
推荐答案
在R2018a中,引入了图形属性"WindowState",请参见 https://blogs.mathworks.com/pick/2018/07/13/maximize-your-figures/
In R2018a, the figure property "WindowState" was introduced, see https://blogs.mathworks.com/pick/2018/07/13/maximize-your-figures/
使用此功能,您可以
set(0, 'DefaultFigureWindowState', 'minimized');
在运行实际脚本之前,这将导致所有标准图解"都不会失去焦点,而是以最小化状态打开.
before running the actual script, and this will cause all "standard plots" to not steal focus and be opened in minimized state.
有些功能仍然会引起人们的关注.我没有详细研究,但我相信它主要是自动绘图功能,例如psd,hist等,没有输出参数.如果您自己拨打plot
,您应该没事.
There are functions that still steal focus. I did not investigate in detail, but I believe it's mainly automatic plotting functions such as psd, hist etc. without output arguments. If you call plot
yourself you should be fine.
这篇关于禁止MATLAB自动对焦的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!