hist actually takes vectors as input arguments, you wrote a matrix, so it just handles your input as if it was several vector-inputs. The output are the number of elements for each container (in your case 1:3, the second argument).
[m,n] = hist([1,2,3;4,5,6;1,2,3],1:3)
treats each column as one input. You put in 3 inputs (# of columns) and you get 3 outputs.
[2 0 1]'
means, for the input [1;4;1] and the bin 1:3 two elements are in bin 1 and one element is in bin 3.
Look at the last column of m, here all three values are in the third bin, which makes sense, since the corresponding vector is [3;6;3], and out of those numbers all have to go into the bin/container 3.
hist
actually takes vectors as input arguments, you wrote a matrix, so it just handles your input as if it was several vector-inputs. The output are the number of elements for each container (in your case1:3
, the second argument).treats each column as one input. You put in 3 inputs (# of columns) and you get 3 outputs.
means, for the input
[1;4;1]
and the bin1:3
two elements are in bin 1 and one element is in bin 3.Look at the last column of
m
, here all three values are in the third bin, which makes sense, since the corresponding vector is[3;6;3]
, and out of those numbers all have to go into the bin/container 3.