Histogram of a vector or a matrix
H=histcalc(x)
H is a sparse vector
The vector or matrix x is converted to integer. It must contain only positive values.
The vector or matrix x is converted to integer. A histogram vector with max(x)-Elements is created. Each position J of the vector H contains the number of elements of x, which have the value J.
The execution time is dependent on the different kind of entries of x. It is not mainly dependant on the size of x!
Much faster is the function fasthist !
// Generate a Testmatrix A=testmatrix('frk',10)+1; H1=histcalc(A); // Now, we add a constant to A... // let us see, what happens H2=histcalc(A+6); disp(H1); disp(H2); | ![]() | ![]() |