Splitting groups into seperate tables

1 Ansicht (letzte 30 Tage)
Machine Learning Enthusiast
Machine Learning Enthusiast am 29 Sep. 2019
Beantwortet: Peter Perkins am 4 Nov. 2019
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.

Antworten (1)

Peter Perkins
Peter Perkins am 4 Nov. 2019
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]

Kategorien

Mehr zu Data Preprocessing finden Sie in Help Center und File Exchange

Community Treasure Hunt

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

Start Hunting!

Translated by