Event-based script without any infinite loop

1 次查看(过去 30 天)
Hello! is it possible to create an event and listeners based script (without GUI) that doesn't contain any infinite loops? If yes, how can I do this? Thank you.

采纳的回答

Chunru
Chunru 2021-7-31
doc timer. Here is an example to display a message every 3sec for 3 times:
t = timer;
t.StartDelay = 3;
t.TimerFcn = @(myTimerObj, thisEvent)disp('3 seconds have elapsed');
t.Period = 2;
t.TasksToExecute = 3;
t.ExecutionMode = 'fixedRate';
start(t)

更多回答(0 个)

类别

Help CenterFile Exchange 中查找有关 Loops and Conditional Statements 的更多信息

产品


版本

R2021a

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!

Translated by