When many figure windows present, the pause command doesn't work
조회 수: 4 (최근 30일)
이전 댓글 표시
When Matlab plots many figures and then the pause command, it does not recognize that the user presses enter to move on to the next line of code. I have to hit ctrl+c to break out of the code. If you use Nfigures = 5, it usually works pretty fast, like you'd expect (toc says ~1sec). If you use Nfigures = 50, it will just take quite a while (20+seconds, or forever, but it should take 0sec) after you hit enter, or hit enter a bunch. If you use Nfigures=500 it will basically never continue past the pause, no matter how many times you hit enter, no matter how long you wait.
Clarifications: I see that "Press enter to continue..." shows up before the figures are created. That's fine. I'm not talking about that. Wait until all 500 figures are created. Press enter with the figures in focus, nothing happens. Click back Into the command window and press enter, nothing happens. Press enter a whole bunch, still nothing. Then eventually you'll have to press ctrl+c. To be clear, I'm not complaining about it taking whatever time it takes to generate 5 or 500 figures. That's fine. I'm complaining about that the PAUSE function does not recognize that I have pressed enter after it is done with plotting/figure generation.
I think this is some kind of bug in Matlab. It happens on my computer and also an officemate's computer. Sufficiently different computer setups, and also sufficiently "not old crummy computer" setups (both i7, etc.) Can someone else confirm? Am I doing something wrong?
close all; clear all; clc;
Nfigures = 500;
for iFig = 1:Nfigures;
figure;
end;
disp('Press enter to continue...'); tic; pause;
disp('This text should display as soon as you press enter and give you double carrots');
toc
Comp1: Matlab 2016a Windows 7pro 64bit Intel core-i7 3770 3.4GHz 8GB Ram. Comp2: Matlab 2016a Windows 10 64bit Intel core-i7 5820 3.3GHz 16GB Ram
댓글 수: 0
답변 (1개)
CS Researcher
2016년 5월 1일
I think it takes 20+ seconds because you first close all the open figures while the tic has already started. It computes all the time (time for you to close all the open figures and press enter). Press enter by going to the command window without closing all the figures and it will be fine.
참고 항목
카테고리
Help Center 및 File Exchange에서 Install Products에 대해 자세히 알아보기
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!