当Matlab
正在处理包含plot()
命令的代码时,Matlab
将窃取窗口焦点,当plot()
已处理。虽然许多人似乎觉得这种行为很烦人,但我发现它作为一个警报很有用,告诉我绘图何时被处理,并且我可以在 Matlab
运行时做其他事情。
但是,我希望在计算完成时让 Matlab 窃取窗口焦点(Matlab
空闲),而不仅仅是当我包含 plot()
或figure()
命令。
我发现了一篇关于禁用 plot()
和 figure()
窗口窃取行为的帖子( Inhibit Matlab Window Focus Stealing ),但不能在计算完成时添加窗口窃取行为。能做到吗?
最佳答案
要使Matlab命令窗口获得焦点,可以在计算后添加commandwindow
。来自 documentation ,
commandwindow
opens the MATLAB® Command Window when it is closed, and selects the Command Window when it is open.
要使现有图窗获得焦点,您可以添加 figure(h)
,其中 h
是图窗句柄。来自 documentation ,
figure(h)
does one of the following [...]If
h
is the handle or the Number property value of an existing figure, thenfigure(h)
makes that existing figure the current figure, makes it visible, and moves it on top of all other figures on the screen. The current figure is the target for graphics output.
关于matlab - 使 MATLAB 编辑器或命令窗口以编程方式获取焦点,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/32331260/