MATLAB: Does the upper limit on the x-axis of a bar chart round up to the next highest power of ten in MATLAB 7.0.1 (R14SP1) and prior versions

barchart;limitupperx axisxlim

When I create a bar chart using the following commands,
A = rand (64, 1);
bar(A);
I obtain a plot, which has the following x-axis limits:
0 70
The documentation states:
The x-axis scale ranges from 1 to length(Y) when Y is a vector, and 1 to size(Y,1), which is the number of rows, when Y is a matrix.
This suggests the upper limit on the x-axis should be 64.

Best Answer

This bug has been fixed in Release 14 Service Pack 2 (R14SP2). For previous releases, please read below for any possible workarounds:
This has been verified as an error in the documentation in MATLAB 7.0.1 (R14SP1) and previous versions.
To obtain the behavior described in the documentation, use the following command:
set(gca,'xlim', [1 length(A)]);