Constructing for loop in terms of seconds

47 visualizaciones (últimos 30 días)
Yigit
Yigit el 20 de Nov. de 2011
Comentada: vcmorini el 22 de Abr. de 2017
Hi,
for(10 seconds){
do this }
I would like to construct the following but I couldn't figure out how to input loop parameter in terms of time.
Thanks

Respuesta aceptada

Jan
Jan el 20 de Nov. de 2011
It does not work with a FOR loop, but with WHILE:
t0 = clock;
while etime(clock, t0) < 10
pause(0.05); % Some dummy lines
disp(clock);
end

Más respuestas (0)

Categorías

Más información sobre Loops and Conditional Statements en Help Center y File Exchange.

Etiquetas

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!

Translated by