manipulate time (add 10 minutes) in a time series

15 次查看(过去 30 天)
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

回答(1 个)

Monisha Nalluru
Monisha Nalluru 2021-3-8
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 个评论
Jonathan
Jonathan 2021-3-22
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

请先登录,再进行评论。

类别

Help CenterFile Exchange 中查找有关 Calendar 的更多信息

Community Treasure Hunt

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

Start Hunting!

Translated by