How can I group column of data with the same time stamp and get the row mean of each group?

조회 수: 5 (최근 30일)
from this table to this image where
x = Height
t = time
u = zonal wind

채택된 답변

Cris LaPierre
Cris LaPierre 2019년 2월 17일
The functions findgroup and splitapply allow you to group by similar time and take a mean of all data in each group. However, that works for column data (your raw data), and not for your summary tables (bottom images). There may be a way to create groups by hour instead of time so you don't have to combine columns.
  댓글 수: 10

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

추가 답변 (2개)

Peter Perkins
Peter Perkins 2019년 2월 17일
retime on a timetable is the simplest way to compute means per time bin:
>> tt = timetable(rand(10,1),'RowTimes',duration((sort(3*rand(10,1))),0,0))
tt =
10×1 timetable
Time Var1
________ _______
00:02:08 0.35166
00:09:42 0.83083
00:13:39 0.58526
00:23:22 0.54972
01:00:40 0.91719
01:24:29 0.28584
01:35:32 0.7572
01:42:23 0.75373
02:20:15 0.38045
02:48:07 0.56782
>> ttHourlyMean = retime(tt,'hourly','mean')
ttHourlyMean =
3×1 timetable
Time Var1
________ _______
00:00:00 0.57937
01:00:00 0.67849
02:00:00 0.47413
You can then unstack that if you want. It's not at all clear to me how you got to those regular heights, 3000, 2500, etc. Maybe those are height bins, and you're really doing 2-D grouping. retime won't do that, splitapply, groupsummary, or a grouped varfun is the way to go for that.

Teddy2018
Teddy2018 2019년 2월 17일
the height bins are default height generated by the instrument.

카테고리

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

제품


릴리스

R2016a

Community Treasure Hunt

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

Start Hunting!

Translated by