accumarray
allows to aggregate items of an array in various ways, potentially applying some function to the items in the process. accumarray
can be thought of as a lightweight reducer (see also: Introduction to MapReduce ).
This topic will contain common scenarios where accumarray
is especially useful.
Parameter | Details |
---|---|
subscriptArray | Subscript matrix, specified as a vector of indices, matrix of indices, or cell array of index vectors. |
valuesArray | Data, specified as a vector or a scalar. |
sizeOfOutput | Size of output array, specified as a vector of positive integers. |
funcHandle | Function to be applied to each set of items during aggregation, specified as a function handle or [] . |
fillVal | Fill value, for when subs does not reference each element in the output. |
isSparse | Should the output be a sparse array? |
accumarray
", by Loren Shure, February 20, 2008.accumarray
in the official MATLAB documentation.