Run into "Paused: Press any key"
73 次查看(过去 30 天)
显示 更早的评论
I'm using Matlab 2020a to do some simulation. The old code has been used for monthly, but starting from last week it always run into an automatic pause showing "Paused: Press any key" on the lower left cornor of the command Window...Sometimes, it paused in a few minutes, and sometimes in about an hour...I do have two lines
pause(1);
pause(0.01);
in the for loop, but it would be run every loop. So I don't know where this pause unexpected come from
Any idea?
0 个评论
回答(1 个)
Jan
2021-6-10
This problem appeared in R2016a already: https://www.mathworks.com/matlabcentral/answers/278430-why-does-program-execution-hang-when-using-pause
The workaround have been strange. Do you need pause command in your code? Try to replaces them by drawnow. Do you need Matlab to wait for a certain time? Then try:
java.lang.Thread.sleep(duration*1000)
This has less jitter than pause() also.
另请参阅
类别
在 Help Center 和 File Exchange 中查找有关 Introduction to Installation and Licensing 的更多信息
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!