Convert hourly temperature data into daily in the specific time interval
조회 수: 4 (최근 30일)
이전 댓글 표시
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 !
댓글 수: 0
채택된 답변
Peng Li
2020년 3월 24일
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.
댓글 수: 0
추가 답변 (0개)
참고 항목
카테고리
Help Center 및 File Exchange에서 Data Type Conversion에 대해 자세히 알아보기
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!