I am trying to achieve two things:
- Start a function if the current time is an exact 10 seconds multiple and
- Run the function in a loop every 10 seconds after that
I have a cronjob on AWS pulling data every 10 seconds. I want my MATLAB function to run specifically once that has been updated (every 10 seconds).
The function takes less than 10 seconds to run. Currently, I am doing:
tic
function
toc
elapsedTime=toc;
pause(10-elapsedTime);
but this dosent seem to be working. On top of that, I want the entire function to start at 1:00:10 (seconds).
I think using Matlab's
format shortg
c = clock
fix(c)
and some how starting at sec = [0,10,20....,60] would work, but I am not sure how to isolate the seconds from the system clock.