Create an array by accumulating the elements of a vector into the positions defined by their subscripts.
accumarray (subs, vals, sz)
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.