Can't Select Command Window While Program Runs

7 visualizzazioni (ultimi 30 giorni)
Richard Clark
Richard Clark il 1 Lug 2011
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

Risposte (1)

Paulo Silva
Paulo Silva il 1 Lug 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?

Categorie

Scopri di più su Entering Commands in Help Center e File Exchange

Community Treasure Hunt

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

Start Hunting!

Translated by