Y = splitapply(func, A, G)
Y = splitapply(func, A1, ..., An, G)
[Y1, ..., Ym] = splitapply(func, ..., G)
| Parameter | Description |
|---|---|
| func | a function handle applied to each group. |
| A, A1, ..., An | the data to split by group (rows). |
| G | group numbers, typically from findgroups. |
| Parameter | Description |
|---|---|
| Y | the results, with one row per group. |
Y = splitapply(func, A, G) splits A into groups according to G and applies func to each group, concatenating the results.
G = findgroups([1; 2; 1; 2; 1]);
Y = splitapply(@sum, [10; 20; 30; 40; 50], G)
| Version | Description |
|---|---|
| 2.0.0 | initial version |