One Minute One-liners for the curious: https://www.youtube.com/@1minute1liners
In this YouTube short, I explain how to create a faster histogram function using arithmetic on indices. The one-liner in Matlab/Octave is:
SX=sort(X); I=find(diff([-Inf,SX,Inf])>0); N=diff(I); H=SX(I(2:end)-1);
Below are the functions inthist.m and the test code tinthist.m.