## Documentation Center |

Construct array with accumulation

` A = accumarray(subs,val)` returns
an array,

The ith row of `subs` corresponds to the ith
element in the vector, `val`. The function collects
all elements of `val` that have identical subscripts
in `subs`, applies the function `@sum`,
and then stores the result in the location of `A` corresponding
to the subscript. Elements of `A` that are not referred
to by any row of `subs` contain the value `0`.

` A = accumarray(subs,val,sz)` returns
an array,

` A = accumarray(subs,val,sz,fun)` applies
the function

`full` | `function_handle` | `histc` | `sparse` | `sum`

Was this topic helpful?