fasthist - fast calculation of histogram
The function fasthist uses sparse functions to calculate the histogram in a single step. No while loops are needed. The matrix A may contain positive numbers larger or equal 1.
//The result vector h (sparse) represents the histogram, that means the number of occurences of elements of the vector A. H has the length max(int(a)).
// Generate a Testmatrix A=testmatrix('frk',10)+1; H1=fasthist(A); // Now, we add a constant to A... // let us see, what happens H2=fasthist(A+6); disp(H1); disp(H2); // End of Example