Setting timer to repeat a dos command
10 次查看(过去 30 天)
显示 更早的评论
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 个评论
Geoff Hayes
2020-2-7
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...
回答(0 个)
另请参阅
类别
在 Help Center 和 File Exchange 中查找有关 Startup and Shutdown 的更多信息
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!