Why do figure windows in popup in front of other applications in MATLAB 7.1 (R14SP3)?

2 views (last 30 days)
I start a MATLAB file that creates figure windows. While the script is running, I start using another application. The figures come up in front of the other application, even though MATLAB no longer has focus.

Accepted Answer

MathWorks Support Team
MathWorks Support Team on 21 Jan 2010
Though it is a limitation, the software is behaving as expected. We recognize that a more efficient protocol would be preferred and we are working towards addressing this need.
While it is not possible to work-around this issue in all cases, it is sometimes possible to avoid it by refraining from the use of functions that cause figures to gain focus. This includes the FIGURE, AXES, GCF, and GCA functions, as well as any of the functions that implicitly call these.
For instance, if suppose your application was the following:
c = 0;
for c = 1:10000
pause(1);
close all;
x = rand(1, 10);
y = rand(1, 10);
line(x, y);
set(gcf, 'Name', num2str(c));
end
You could then re-configure it as:
f = figure;
a = axes;
c = 0;
for c = 1:10000
pause(1);
x = rand(1, 10);
y = rand(1, 10);
cla(a);
line(x, y, 'Parent', a);
set(f, 'Name', num2str(c));
end
Here, the old axes is cleared with the CLA function, instead of recreating it on every iteration. Additionally, the use of GCA and GCF is avoided by passing the appropriate handles to CLA, LINE, and SET.

More Answers (0)

Categories

Find more on Introduction to Installation and Licensing in Help Center and File Exchange

Products


Release

R2007b

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!