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

    %% Bin Counts and Bin Edges
% Distribute 100 random values into bins. |histcounts| automatically
% chooses an appropriate bin width to reveal the underlying distribution of
% the data.

% Copyright 2015 The MathWorks, Inc.

X = randn(100,1);
[N,edges] = histcounts(X)