MATLAB: Manually specified BinCounts and BinEdges in histogram does not work

bincountshistogram

Hi everyone,
I tried to plot a histogram by giving the BinCounts and BinEdge, but it does not work. This is the example given by matlab in the histogram properties section:
histogram('BinEdges',-2:2,'BinCounts',[5 8 15 9])
I copy and past their example and I get the error:
Error using histogram Expected input number 1, x, to be one of these types:
double, single, uint8, uint16, uint32, uint64, int8, int16, int32, int64
Instead its type was char.
Error in histogram (line 114) validateattributes(x,{'numeric'},{'real'}, mfilename, 'x', 1)
They are expecting a double as first argument…Am I doing something wrong? For information I use matlab R2015a.
Thank you,
Syl

Best Answer

You really ought to look at the documentation that comes with your version. That particular syntax is new as of R2016b. Hint:
doc histogram
from matlab command window.