Why is Ctrl-C inconsistent in breaking out of loops in MATLAB 7.0 (R14)?
1 visualización (últimos 30 días)
Mostrar comentarios más antiguos
I have a MATLAB file function or script that executes a loop many times. When debugging the application, I occasionally need to stop execution before it completes all the iterations of the loop. In MATLAB 6.5 (R13) and earlier versions, Ctrl-C consistently stopped execution of MATLAB functions. In MATLAB 7.0 (R14), Ctrl-C seems to work less frequently.
Respuesta aceptada
MathWorks Support Team
el 1 de Sept. de 2009
Pressing Ctrl-C while MATLAB is performing a computation adds to a pending event queue. This queue is not necessarily processed during each iteration of a loop, which leads to the behavior where Ctrl-C does not appear to affect program execution. Insert DRAWNOW in the loop to force MATLAB to process the event queue at each iteration of the loop, even if your program does not generate any figures. This will ensure that the event queue is processed at each iteration of the loop when DRAWNOW is called. An example of how to use DRAWNOW is shown below:
for i = 1:10000
j = i^2;
drawnow;
end
0 comentarios
Más respuestas (0)
Ver también
Categorías
Más información sobre Introduction to Installation and Licensing en Help Center y File Exchange.
Productos
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!