Convert 10-minute wind data into hourly wind data

조회 수: 1 (최근 30일)
Tadgh Cullen
Tadgh Cullen 2015년 9월 15일
댓글: Adam 2015년 9월 15일
Hi,
I have wind data as attached, and have read it in so that
Speed - 52561x1 double
TimeStep - 52561x1 datetime
I can't figure out how to convert this data into hourly averaged data. I've tried it in excel using pivot tables but can't get the format correct so i have turned to Matlab. I have attempted multiple methods from previous questions but not very savvy with Matlab so keep getting errors. Hopefully someone can help
Thanks in advance

채택된 답변

Adam
Adam 2015년 9월 15일
Assuming you do not have any missing times you should just be able to trim off one value from your results to have a data set of size divisible by 6 and then something like:
speeds = reshape( speed, 6, [] );
speedAvg = mean( speeds );
If you have gaps in your time array then you will, of course, need to do something more complicated to deal with those.
  댓글 수: 2
Tadgh Cullen
Tadgh Cullen 2015년 9월 15일
That works great for the speed. How could I apply this to get the corresponding timestep? I.e basically just list out the timestep every hour in the format DD/MM/YY HH/MM?
Adam
Adam 2015년 9월 15일
You should be able to reshape your datetime array in exactly the same way. I've never really used datetime though so I'm not too familiar with all its different formats, but there are quite a few examples for formatting on the help page.
TimeStep.Format = 'dd/MM/yy HH:mm';
seems to do the job I think.

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

추가 답변 (0개)

카테고리

Help CenterFile Exchange에서 Multidimensional Arrays에 대해 자세히 알아보기

태그

제품

Community Treasure Hunt

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

Start Hunting!

Translated by