MATLAB: Splitapply table for zscore

splitapplyzscore

I have a table in the format:
Group Score
A 3
B 7
C 18
A 10
How do I combine the splitapply function for table variables with zscore , such that it calculates zscore(Score) according to Group rather than the whole table?
I have tried:
[G,results] = findgroups(Table.Group);
ZS = splitapply(@zscore,Table.Score,G);
results.ZS = ZS

Best Answer

splitapply is more for computing scalar summaries. Try using varfun, with a grouping variable, returning a table. Something like
t2 = varfun(@zscore,t,'GroupingVariable','Group')