Print out a warning every whole second in Matlab
I am trying to print a warning or just a message after every second, like "1 second elapsed". Is there a possibility to realize that? I tried it with tic toc and a loop, but it is pretty insufficient. Furthermore I never get exactly one second. Is there a command that prints every X ms automatically? Any ideas? Thanks in advance. Use a timer object. t = timer; t.ExecutionMode = 'fixedRate'; t.Period = 1; t.TimerFcn = @(~,~)disp('1s elapsed'); start(t) Amro As @Daniel suggested , timer objects are the way to go. One thing to remember is that MATLAB timers execute asynchronously but are not