From: Val Schmidt on
Does anyone know, is there a way to call hist3 (or something similar) to conduct a 3D histogram on a matrix of data, but to also return a matrix of indices specifying which bin each of the data points were placed? I know I can do this manually with histc functions, but it's cumbersome.
Thanks,
Val
From: Peter Perkins on
On 3/9/2010 2:13 PM, Val Schmidt wrote:
> Does anyone know, is there a way to call hist3 (or something similar) to
> conduct a 3D histogram on a matrix of data, but to also return a matrix
> of indices specifying which bin each of the data points were placed?

HIST3 is more similar to HIST than to HISTC, so it doesn't do that, but it would be easy to create a local copy of HIST3 that did what you want. I believe all you would need to do would be to add the variable "bin" to the output arg list that's already there.

Hope this helps.
From: Val Schmidt on
Thanks Peter, I'll give it a try.
From: Bruno Luong on
"Val Schmidt" <vschmidt(a)N0SPAM.ccom.unh.edu> wrote in message <hn66jv$8bd$1(a)fred.mathworks.com>...
> Does anyone know, is there a way to call hist3 (or something similar) to conduct a 3D histogram on a matrix of data, but to also return a matrix of indices specifying which bin each of the data points were placed? I know I can do this manually with histc functions, but it's cumbersome.
> Thanks,
> Val

You can check this out:
http://www.mathworks.com/matlabcentral/fileexchange/23897-n-dimensional-histogram

Bruno