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 CenterFile Exchange에서 Tables에 대해 자세히 알아보기

Community Treasure Hunt

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

Start Hunting!

Translated by