0

Matlab command inside a for loop keeps the focus on the figure when it gets refreshed and therefore it is not possible to work on the computer while a long code is running. Is there a remedy for this behavior or an alternative to getframe command?

EDIT: My problem is that when I include the getframe statement in the for loop each time the plot gets updated the computer focuses on the figure window and I get distracted; it has nothing to do with capturing something else which is on the screen at the moment. My code snippet for plotting is:

h=imagesc(delta*(1:1:xdim)*1e+6,(delta*(1:1:ydim)*1e+6)',Ez',[-1,1]);
set(h,'AlphaData',2.5*epsilon'/epsilon0);
title(['\fontsize{20}Color-scaled image plot of Ez in ring resonator with PML boundary and at time=',num2str(round(n*deltat*1e+15)),' fs']);
xlabel('x (in um)','FontSize',20);
ylabel('y (in um)','FontSize',20);
set(gca,'FontSize',20);
getframe; 
Vesnog
  • 773
  • 2
  • 16
  • 33
  • 1
    possible duplicate of [MATLAB getframe captures whatever is on screen](http://stackoverflow.com/questions/8565404/matlab-getframe-captures-whatever-is-on-screen) – see also [Render MATLAB figure in memory](http://stackoverflow.com/q/4137628/2278029) and this [solution from The MathWorks](http://www.mathworks.com/matlabcentral/answers/99925-why-does-the-screensaver-get-captured-when-i-use-getframe-on-a-matlab-figure-window-while-creating-a). – horchler May 22 '15 at 23:11
  • Note that, according to R2015a, the undocumented `hardcopy` function that some solutions use is slated to be removed in the future. One can use [`print`](http://www.mathworks.com/help/matlab/ref/print.html) instead (which used to be based on `hardcopy` in older versions). – horchler May 22 '15 at 23:21
  • These issues are related due to how rendering/capturing can be performed. See the second link in my first comment. – horchler May 22 '15 at 23:28

0 Answers0