MATLAB Answers

Convert hourly temperature data into daily in the specific time interval

8 views (last 30 days)
Behzad Navidi
Behzad Navidi on 24 Mar 2020
Answered: Peng Li on 24 Mar 2020
I have a 3d matrix (81x69x8760). In essence, 8760 is hours of one year or 8784 if it was a leap year. I would like to get daily values from this hourly data. The problem is in this data each day starts at 00:00:00 and ends at 23:00:00 BUT I want to consider day means from 01:00:00 to next day 00:00:00.
For example I have data for this dates below: I would like to use mean of bold line as 01-Jan-2019 data:
'01-Jan-2019 00:00:00'
'01-Jan-2019 01:00:00'
'01-Jan-2019 02:00:00'
'01-Jan-2019 03:00:00'
'01-Jan-2019 04:00:00'
'01-Jan-2019 05:00:00'
'01-Jan-2019 06:00:00'
'01-Jan-2019 07:00:00'
'01-Jan-2019 08:00:00'
'01-Jan-2019 09:00:00'
'01-Jan-2019 10:00:00'
'01-Jan-2019 11:00:00'
'01-Jan-2019 12:00:00'
'01-Jan-2019 13:00:00'
'01-Jan-2019 14:00:00'
'01-Jan-2019 15:00:00'
'01-Jan-2019 16:00:00'
'01-Jan-2019 17:00:00'
'01-Jan-2019 18:00:00'
'01-Jan-2019 19:00:00'
'01-Jan-2019 20:00:00'
'01-Jan-2019 21:00:00'
'01-Jan-2019 22:00:00'
'01-Jan-2019 23:00:00'
'02-Jan-2019 00:00:00'
'02-Jan-2019 01:00:00'
Unfortunatly the original file is too large to attache so I cut a little sample of it.
I want to ask you if you please help me what can I do?
Thanks you !


Sign in to comment.

Accepted Answer

Peng Li
Peng Li on 24 Mar 2020
If this is in a datetime variable type, how about you offset your original time by 1 hr (e.g., yourVarName - hours(1)). After that you can group them by date and perform average over each group (consider using findgroups function). This can be done easily using splitapply function if this is a table variable.


Sign in to comment.

More Answers (0)





Community Treasure Hunt

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

Start Hunting!