HISTCND is similar to HISTC, but creates a histogram with any number of dimensions.
N = HISTCND(X,Y,Z,... XEDGES,YEDGES,ZEDGES,... )
where N is a histogram count with dimensions
length(XEDGES) x length(YEDGES) x length(ZEDGES) ...
If XEDGES, YEDGES, etc. are monotonically increasing and non-NaN, a data point is assigned to bin N(i,j,k,...) if
XEDGES(i) <= X < XEDGES(i+1)
YEDGES(j) <= Y < YEDGES(j+1)
ZEDGES(k) <= Z < ZEDGES(k+1)
Note: data outside the ranges of the EDGES vectors are excluded from the histogram, and not placed in the first or last bins.
Hi, I've been unable to produce this error. I tried with 4 columns of 1,000,000 data points, with 20 edge points for each dimension.
Using too many edge points (histogram bins) will make the output array too big for matlab to handle.
In the linux program 'top', I saw the MATLAB process was using around 4% of the memory (system has 4GB). Maybe you could try the code below, and see if it works on yours.
Elapsed time is 2.554106 seconds.
20 20 20 20
I'm trying to use your program but it gives me an error that says "out of memory". I've been feeding in 4 columns of 10000 data points into the program.
Bug Fix: the behaviour is now consistent for data above and below ranges of the edges vectors.
Added comments to explain the algorithm. Small optimization of code.
Added an example to the description.
Download apps, toolboxes, and other File Exchange content using Add-On Explorer in MATLAB.