I have an array a(30,2) where the first column is a unique sample number and the second column is a value assigned to the sample. I plot a histogram of the 2nd
a(30,2)
Use histc, which return an index for each entry, to which bin did it 'fall':
histc
[n, bin] = histc (a(:, 2), bins);
Then the samples above the k'th bin is:
a(bin==k, 1);
Pay attention, you must specify the bins' boundaries yourself (unlike hist which uses the mid-value between boundaries).
hist