Reputation: 289
I want to iterate a system in order to model a bicile system like https://www.bicing.cat/ in a whole month. Thus, I need to iterate the system during some time.
It works in a right way, but the problem I am facing is that this way doesn't change from 23:59 to 00:00, it does it until 99:99. And the same happens with the date.
The format I am now using is the following: yyyymmddhhmm dd = day mm = month yyyy = year hh = hour mm= minute
for i=2:final_time-initial_time+1
Upvotes: 0
Views: 1530
Reputation: 36710
Matlab provides some support using dates.
%start time
stime=datenum(2012,1,2,3,42,00)
%end time
etime=datenum(2014,3,5,3,23,00)
%length of time step (1D, 3min in this case)
delta=datenum(0,0,1,0,3,0)
for nw=stime:delta:etime
datestr(nw)
end
You may also use datevec to split nw into a vector [Y, M, D, H, MN, S]
Upvotes: 1