Can't Select Command Window While Program Runs
7 Ansichten (letzte 30 Tage)
Ältere Kommentare anzeigen
Hello!
I currently have a program that takes about five minutes to run. Within the program I have a counter so that I can monitor the command window to be sure I don't get stuck in an endless loop. For some reason, when my program is running, I am unable to select the main MATLAB window. My workaround right now is to hover the mouse over the preview in Windows 7, which fills up the screen, but I have to keep the mouse there the entire time.
Currently the program generates some figures, but I'm not sure if that is part of the problem.
Thank you for your help in advance, and I'll be more than happy to provide more info!
Rick
0 Kommentare
Antworten (1)
Paulo Silva
am 1 Jul. 2011
doc drawnow
doc pause
Any of them should allow you to see what's going on.
Try this code:
t = 0:pi/20:2*pi;
y = exp(sin(t));
h = plot(t,y,'YDataSource','y');
for k = 1:.1:50
y = exp(sin(t.*k));
refreshdata(h,'caller') % Evaluate y in the function workspace
drawnow;
pause(.1)
end
Now comment the pause line
t = 0:pi/20:2*pi;
y = exp(sin(t));
h = plot(t,y,'YDataSource','y');
for k = 1:.1:50
y = exp(sin(t.*k));
refreshdata(h,'caller') % Evaluate y in the function workspace
drawnow;
%pause(.1)
end
Now comment the pause and drawnow line
t = 0:pi/20:2*pi;
y = exp(sin(t));
h = plot(t,y,'YDataSource','y');
for k = 1:.1:50
y = exp(sin(t.*k));
refreshdata(h,'caller') % Evaluate y in the function workspace
%drawnow;
%pause(.1)
end
Do you see any difference?
0 Kommentare
Siehe auch
Kategorien
Mehr zu Entering Commands finden Sie in Help Center und File Exchange
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!