1

I use an optimization algorithm to find an optimal shape for a certain functional. I made the program show me the current figure at every iteration to see where everything is going. The problem is that I cannot do anything while the program works (and the program takes 5-10 minutes to finish), because the figure keeps popping up on top, and if I am writing something, for example, the window focus changes on the matlab figure.

It is possible to keep the matlab figure from being on top when the figure changes? For example I use a dual monitor setup, and moved the figure to the second monitor. Can the figure change without changing the focus from the current window I work in?

Beni Bogosel
  • 572
  • 1
  • 6
  • 22
  • In addition to being a similar question, the link in the first comment has an answer describing a good solution to your problem. Take a look there! – tmpearce Jan 22 '13 at 12:00
  • @tmpearce: Thank you. I've found something similar myself, but I did not searched using the right terms initially. – Beni Bogosel Jan 22 '13 at 16:34

1 Answers1

1

Won't using OuterPosition do the trick? Here's an example that should keep the figure in the top right third of the screen:

scnsize = get(0,'ScreenSize'); % get screen size
fig1 = figure;
position = get(fig1,'Position')
outerpos = get(fig1,'OuterPosition')
borders = outerpos - position
edge = -borders(1)/2;
pos1 = [scnsize(3)/2 + edge,...
    scnsize(4) * (2/3),...
    scnsize(3)/2 - edge,...
    scnsize(4)/3];

Reposition the figure by changing its OuterPosition properties:

 set(fig1,'OuterPosition',pos1) 

There's also this option to disable an entire figure window while some processing is taking place....

bla
  • 25,846
  • 10
  • 70
  • 101
  • 1
    Thank you for your answer. I think you talk about position of the figure window, but I was more interested in the focus stealing thing. – Beni Bogosel Jan 22 '13 at 16:37