라이선스가 부여된 사용자만 번역 문서를 볼 수 있습니다. 번역 문서를 보려면 로그인하십시오.
# accumarray

## Syntax

## Description

## Examples

## Input Arguments

## Output Arguments

## More About

## See Also

#### Introduced before R2006a

Construct array with accumulation

returns
array `A`

= accumarray(`subs`

,`val`

)`A`

by accumulating elements of vector `val`

using
the subscripts `subs`

. If `subs`

is
a column vector, then each element defines a corresponding subscript
in the output, which is also a column vector. The `accumarray`

function
collects all elements of `val`

that have identical
subscripts in `subs`

and stores their sum in the
location of `A`

corresponding to that subscript (for
index `i`

, `A(i)=sum(val(subs(:)==i))`

).
Elements of `A`

whose subscripts do not appear in `subs`

are
equal to 0.

For an * m*-by-

`n`

`subs`

,
each row represents an `n`

`A`

. The ith row of `subs`

corresponds
to the ith element in the vector `val`

.

returns
an array, `A`

= accumarray(`subs`

,`val`

,`sz`

)`A`

, with size `sz`

. Specify `sz`

as
a vector of positive integers to define the size of the output, or
as `[]`

to let the subscripts in `subs`

determine
the size of the output. Use `sz`

when `subs`

does
not reference trailing rows, columns, or dimensions that you would
like to be present in the output.

`full`

| `histcounts`

| `sparse`

| `sum`

Was this topic helpful?