www.gusucode.com > matlab 案例源码 matlab代码程序 > matlab/ChangeNumberOfHistogramBinsExample.m

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

% Copyright 2015 The MathWorks, Inc.

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;