manipulate time (add 10 minutes) in a time series

조회 수: 9(최근 30일)
Jonathan 2021년 3월 6일
댓글: Jonathan 2021년 3월 22일
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.


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 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.

댓글을 달려면 로그인하십시오.

Community Treasure Hunt

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

Start Hunting!

Translated by