MATLAB: Count number of values of a Matrix inside a range and plot it

matrix arrayrange

Hi!
I have a matrix A which dimension is 100 X 100.
I filtered A in order to obtain its values less than 15 and I obtain matrix B.
B=A;
indices = find(abs(B)>15);
B(indices) = NaN;
I would like to know how to obtain the number of values in B in the folowing ranges:
Number of values of B between 5 and 15
Number of values of B between 4 and 5
Number of values of B between 3 and 4
Number of values of B between 0 and 3
Finally I would like to plot these (numbers of values in these ranges) in a bar graph or hist graph.
Thank you!!

Best Answer

bins = [0,3,4,5,15];
h = histogram(B(:),bins);
To get the counts within each bin,
h.Values