Loop with Fixed time
2 visualizaciones (últimos 30 días)
Mostrar comentarios más antiguos
How can I make the loop with fixed time?
For example:
for i=1:5
somecode;
end
I want to make every calculation time of the loop is about 1 sec And the total calculation time is about 5 sec
0 comentarios
Respuesta aceptada
Azzi Abdelmalek
el 3 de Feb. de 2013
for i=1:5
%somecode;
pause(1-tw) % tw is your computing time
end
%to find your computing time use tic and toc
2 comentarios
Jan
el 5 de Mzo. de 2013
Editada: Jan
el 5 de Mzo. de 2013
The Java sleep() timer is more accurate: see http://undocumentedmatlab.com/blog/pause-for-the-better/. A timer might be even more precise.
Más respuestas (0)
Ver también
Categorías
Más información sobre Clocks and Timers en Help Center y File Exchange.
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!