Suppose I have a function that operates on a table and returns a row vector:
function rowvec = myfunc(Table)
Suppose I have a master table, call it T with one of its variables being Name. I'd like to do something like the following to group by Name and concatenate rowvec computed from each subgroup:
G = findgroups(T.Name);
R = splitapply(@myfunc,T,G);
This won't work because splitapply sends the group of each variable in T to myfunc and not the subtable of T defined by G.
Is there already a function that does what I'm trying to do?
2 Comments
Direct link to this comment
https://uk.mathworks.com/matlabcentral/answers/524298-is-there-a-way-to-execute-splitapply-functionality-on-subtables-of-master-table#comment_844567
Direct link to this comment
https://uk.mathworks.com/matlabcentral/answers/524298-is-there-a-way-to-execute-splitapply-functionality-on-subtables-of-master-table#comment_844567
Direct link to this comment
https://uk.mathworks.com/matlabcentral/answers/524298-is-there-a-way-to-execute-splitapply-functionality-on-subtables-of-master-table#comment_844576
Direct link to this comment
https://uk.mathworks.com/matlabcentral/answers/524298-is-there-a-way-to-execute-splitapply-functionality-on-subtables-of-master-table#comment_844576
Sign in to comment.