Run a loop every hour regardless of its calculation time!
8 visualizaciones (últimos 30 días)
Mostrar comentarios más antiguos
Sonima
el 23 de Mzo. de 2019
Comentada: Bruno Luong
el 16 de Ag. de 2019
Hi All
I want to run a look evey hour and do some math inside the loop.
one solusion is to use tic/toc to get the math time and deduce it from the pause time, but I find it not efficient.
Any solusion to this?
Thanks.
1 comentario
Respuesta aceptada
KALYAN ACHARJYA
el 23 de Mzo. de 2019
Editada: KALYAN ACHARJYA
el 23 de Mzo. de 2019
while true
tic
% some math here
elapsedTime=toc
pause(3600+elapsedTime);
clearvars elapsedTime;
end
% Please note on while loop to avoid infinite run
3 comentarios
Bruno Luong
el 16 de Ag. de 2019
Use timer is much better. I think PAUSE will lock completely 99% of MATLAB.
Más respuestas (1)
Ver también
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!