Effacer les filtres
Effacer les filtres

Event-based script without any infinite loop

1 vue (au cours des 30 derniers jours)
Alex Alex
Alex Alex le 31 Juil 2021
Commenté : Alex Alex le 26 Août 2021
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.

Réponse acceptée

Chunru
Chunru le 31 Juil 2021
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)
  1 commentaire
Alex Alex
Alex Alex le 26 Août 2021
Thanks, this works fine

Connectez-vous pour commenter.

Plus de réponses (0)

Catégories

En savoir plus sur Startup and Shutdown dans Help Center et File Exchange

Produits


Version

R2021a

Community Treasure Hunt

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

Start Hunting!

Translated by