How to get the indices of x and y for the counts that go into every bin.
x = randn(1,10); y = randn(1,10);nbins = [8 8]; [C,Xedges,Yedges] = histcounts2(x,y, nbins); CC = 0 0 0 1 0 1 0 1 0 0 1 1 0 0 0 0 0 0 0 3 0 0 0 0 0 0 0 0 0 0 0 0 0 0 1 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 1 0 0 0 0 0 0 0 [C,Xedges,Yedges, binX, binY] = histcounts2(x,y, nbins); binX(3), binY(4) %will give the opposite, in which bin is element x(3) y(4)
Best Answer