manipulate time (add 10 minutes) in a time series

14 views (last 30 days)
Hi,
I am struggling with a time issue. I have the following meterological data...
'31-Jan-2008 20:00:00' 8.24000000000000
'31-Jan-2008 21:00:00' 8.90000000000000
'31-Jan-2008 22:00:00' 9.10000000000000
'31-Jan-2008 23:00:00' 8.76000000000000
'31-Jan-2008 23:50:00' 8.45000000000000
'01-Feb-2008 00:50:00' 8.12000000000000
'01-Feb-2008 01:50:00' 7.50000000000000
'01-Feb-2008 02:50:00' 7.85000000000000
'01-Feb-2008 03:50:00' 7.05000000000000
The data was originally sampled and reported on the hour (prior to jan 2008 here). However, the time format changed (i.e. in February for the example here) so that the data are now reported 10 minutes before the hour. I would like to maintain consistency with the historical data and report everything as hourly. I have played around with timetable and retime and can get it to interpolate. However, my preference is to add 10 minutes, and round the time up to the next hour. Any suggestions would be much appreciated.
Thanks
Jon

Answers (1)

Monisha Nalluru
Monisha Nalluru on 8 Mar 2021
From my understading,
You want to add 10 mintues to current date format.
He is the example of addding 10 mintues to existing time
time = datetime(2021,3,8,1,50,0);
time1 = time+minutes(10); % added 10 minutes to existing time
Refer to following documentation:
  1 Comment
Jonathan
Jonathan on 22 Mar 2021
Thank you for your response. I did try something like that using retime. However, I only want to add the extra 10 minutes, on those measurements where the time values = 50 minutes. In the example I provide, where the minutes = 0, no adjustment isnecessary.
Thanks
Jon

Sign in to comment.

Categories

Find more on Timetables in Help Center and File Exchange

Community Treasure Hunt

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

Start Hunting!