<< flag_nans_occured utility functions nan_fft >>

NaN Toolbox >> NaN Toolbox > utility functions > nan_accumarray

nan_accumarray

Create an array by accumulating the elements of a vector into the positions defined by their subscripts.

Calling Sequence

accumarray (subs, vals, sz)

Description

Create an array by accumulating the elements of a vector into the positions defined by their subscripts. The subscripts are defined by the rows of the matrix subs and the values by vals. Each row of @var{subs} corresponds to one of the values in vals.

The size of the matrix will be determined by the subscripts themselves. However, if sz is defined it determines the matrix size. The length of sz must correspond to the number of columns in subs.

Examples

nan_accumarray ([1,1,1;2,1,2;2,3,2;2,1,2;2,3,2], 101:105)
ans(:,:,1) = [101, 0, 0; 0, 0, 0]
ans(:,:,2) = [0, 0, 0; 206, 0, 208]

Authors

<< flag_nans_occured utility functions nan_fft >>