Timer callback with alternating paths based upon which path was triggered before

1 Ansicht (letzte 30 Tage)
Hello,
I am trying to built a timer function/ object that reminds me to stop sitting for hours on end, because I am sadly one of those people who sit way too much.
I know how to get a simple timer started up, and have more or less everything I need except for being able to switch between two paths inside the callback function, based upon what was executed before. So if at T0 Path A is triggered within the timer , at T1 we should go to Path B, then at T2 back to A and so on.
For that part though, I have no clue how I would even achieve it.
Thank you and stay healthy.
Sincerely,
C.A.

Akzeptierte Antwort

Sean de Wolski
Sean de Wolski am 23 Dez. 2020
You could use a simple persistent variable in your callback function to maintain state.

Weitere Antworten (0)

Kategorien

Mehr zu Interactive Control and Callbacks finden Sie in Help Center und File Exchange

Tags

Produkte


Version

R2020b

Community Treasure Hunt

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

Start Hunting!

Translated by