Print out a warning every whole second in Matlab

前端 未结 3 1499
轮回少年
轮回少年 2021-01-24 04:43

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 loo

3条回答
  •  再見小時候
    2021-01-24 05:14

    Use a timer object.

    t = timer;
    t.ExecutionMode = 'fixedRate';
    t.Period = 1;
    t.TimerFcn = @(~,~)disp('1s elapsed');
    start(t)
    

提交回复
热议问题