example:
[groups2, aggArray2] = mg_aggregate(array, groupIndex, @(x) sum(x, 1));
compile with:
mex mg_aggregate.cpp
Matthew Gunn (2021). aggregate sections of an matrix based on group ids using a collapse function (https://www.mathworks.com/matlabcentral/fileexchange/53981-aggregate-sections-of-an-matrix-based-on-group-ids-using-a-collapse-function), MATLAB Central File Exchange. Retrieved .
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!Create scripts with code, output, and formatted text in a single executable document.