You could use histc. But histc considers equality at the left edge of each bin, not at its right edge:
bincounts = histc(x,binranges) counts the number of values in x that are within each specified bin range. The input, binranges, determines the endpoints for each bin. The output, bincounts, contains the number of elements from x in each bin.
For example, if binranges equals the vector [0,5,10,13], then histc creates four bins. The first bin includes values greater than or equal to 0 and strictly less than 5. The second bin includes values greater than or equal to 5 and less than 10, and so on. The last bin contains the scalar value 13.
To set the equality condition at the left edges, it's better to do it manually with bsxfun:
y = diff(sum(bsxfun(@le, x(:), 0:10:200), 1));
sum(bsxfun(...), 1) finds how many entries of x are smaller or equal to 0, 10, ... 200; and then diff(...) gives the desired result y:
y =
3 4 1 0 0 0 0 [...] 2
You can then use bar(y) to plot the bars. If you additionally want to change the texts shown on the x-axis, set the 'xticklabel' property of the axes:
bar(y);
strings = {'0-10', '10-20', '20-30'}; %// manually define all strings up to '190-200'
set(gca, 'xticklabel', strings)