Splitting groups into seperate tables

1 回表示 (過去 30 日間)
Machine Learning Enthusiast
Machine Learning Enthusiast 2019 年 9 月 29 日
回答済み: Peter Perkins 2019 年 11 月 4 日
I have table containing data of 25 groups (file attached).How to split data of each group into new table. The first column in attached file contains number of groups.
For instance,
The group ID 8927 contains 730 (columns) x 48 rows
I tried "findgroups" and "splitapply" functions but didnt work for me.

回答 (1 件)

Peter Perkins
Peter Perkins 2019 年 11 月 4 日
MLE, it's not clear what you have done, and what you want to do.
splitapply on a table is for cases when you want to apply a function that takes one input for each variable in a table. You may be seeng an error because you want to apply some function to each variable separately. You can use varfun to do that, or even easier, groupsummary, grouptransform, or groupfilter. Some of the latter three are fairly new.
>> t = readtable('data.csv');
>> groupsummary(t,'Group_ID',@mean)
ans =
25×5 table
Group_ID GroupCount fun1_E_0000_WH fun1_E_0030_WH fun1_E_0100_WH ...
________ __________ ______________ ______________ ______________ ...
1098 730 75.579 61.59 49.756 ...
1151 719 341.55 326.87 298.11 ...
1569 547 139.06 127.13 119.25 ...
1858 1356 160.29 136.18 118.33 ...
[snip]

カテゴリ

Help Center および File ExchangeData Preprocessing についてさらに検索

Community Treasure Hunt

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

Start Hunting!

Translated by