%% Change Number of Histogram Bins
% Generate 1,000 random numbers and create a histogram.

X = randn(1000,1);
h = histogram(X)

%
% Use the morebins function to coarsely adjust the number of bins.

Nbins = morebins(h);
Nbins = morebins(h)

%
% Adjust the bins at a fine grain level by explicitly setting the number of bins.

h.NumBins = 31;

% Copyright 2015 The MathWorks, Inc.