Setting timer to repeat a dos command
10 vues (au cours des 30 derniers jours)
Afficher commentaires plus anciens
hi there!
I 've got a little problem with scripts like this one:
t = timer('TimerFcn', 'stat=false','StartDelay',10);
start(t)
stat=true;
while(stat==true)
dos('dir')
datetime
pause(10)
end
stop(t)
delete(t)
It works one time only or keep repeating ad infinitum. I'm using R2016a.
3 commentaires
Geoff Hayes
le 7 Fév 2020
Gabriel - why not try a pause of 0.5? or even 1.0 seconds? I think that because you are pausing for ten seconds and because your timer expires after ten seconds (due to the StartDelay property being 10), you will only ever see dir be called once...
Réponses (0)
Voir également
Catégories
En savoir plus sur Startup and Shutdown dans Help Center et File Exchange
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!