MATLAB Answers

How can I set up a MATLAB timer for the next day, to run a function the values within which change daily?

7 views (last 30 days)
Manan Sheel
Manan Sheel on 27 Mar 2020
Answered: Dhananjay Kumar on 30 Mar 2020
I am able to set up a timer for the present day for any time after the present time, but I need to run the timer daily and the time should be a few hours before the present time (by present time, I mean the time at which the timer is being set up). If I choose a time before the present time, the 'startat' function gives an error that the time has already passed. I know that to run the timer daily at a specified time, the 'Period' should be made equal to 60*60*24 seconds.
One way to do it, I think is to be present to start the timer, before the time we want it to run daily at. But I need a better technical solution.
Thank you,
Manan.

  1 Comment

Geoff Hayes
Geoff Hayes on 28 Mar 2020
Manan - I think that you need to demonstrate with an example of what you want to accomplish. You state that you know how to run the timer daily at a specified time, so why does that not accomplish what you want? Do you want the timer to run at different times on different days (so not every 24 hours)? Or something else? Please clarify.

Sign in to comment.

Answers (1)

Dhananjay Kumar
Dhananjay Kumar on 30 Mar 2020
Hi Manan,
I think it should be pretty straight forward. You just need to specify the starting time and date in startat to be the time and date of the next day.
Is there anything I am not able to follow here?

  0 Comments

Sign in to comment.