The definition of the edge
handle in hist3
is :
edges{1}(i) <= X(k,1) < edges{1}(i+1)
So in your case:
0<= x <2,
2<= x <4,
4<= x <6,
6<= x
Because it has the <=
logic, the last (4th) part of the histogram are for values that exactly equal 6
.
If you dont like it you can just delete the last row \ column of h
h(:,end)=[];
h(end,:)=[];