Can't Select Command Window While Program Runs
조회 수: 7 (최근 30일)
이전 댓글 표시
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
답변 (1개)
Paulo Silva
2011년 7월 1일
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
참고 항목
카테고리
Help Center 및 File Exchange에서 Entering Commands에 대해 자세히 알아보기
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!