How can I group column of data with the same time stamp and get the row mean of each group?
2 ビュー (過去 30 日間)
古いコメントを表示
from this table to this image where
x = Height
t = time
u = zonal wind
0 件のコメント
採用された回答
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
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.
0 件のコメント
参考
カテゴリ
Help Center および File Exchange で Matrices and Arrays についてさらに検索
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!