Letting accumarray output a table
问题 accumarray uses two rows of indices to create a matrix with elements on the location of valid index pairs with a value assigned by the specified function, e.g.: A = [11:20]; B = flipud([11:20]); C = 1:10; datamatrix = accumarray([A B],C); This way datamatrix will be a 20x20 matrix with values. If the values of A and B however are very large, this will result in a mostly empty matrix, with a small batch of data in the far corner. To circumvent this, one might set accumarray to issparse :