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

x = randn(100,1);
y = randn(100,1);
[N,Xedges,Yedges] = histcounts2(x,y)

% Copyright 2015 The MathWorks, Inc.