How to get the bin elements in histogram plots

Hello there,
I am new to Matlab and i using hist/bar functions for a while now. I have a droplet diameter data (8000x1) and i am able to generate histograms of the distribution with any number of bins.
However, I would like to extract the data used in each bin for another plot. I appreciate any inputs how to extract the data in each bin?
Thanks Kumaran

Réponses (1)

Fangjun Jiang
Fangjun Jiang le 5 Déc 2011

2 votes

[N,BIN] = HISTC(X,EDGES,...) also returns an index matrix BIN. If X is a vector, N(K) = SUM(BIN==K). BIN is zero for out of range values. If X is an m-by-n matrix, then, for j=1:n, N(K,j) = SUM(BIN(:,j)==K); end

2 commentaires

Kumaran
Kumaran le 5 Déc 2011
Thanks Jang,
I did come across that in the doc. Suppose if i do,
[n,Bin]=histc(x(:,6),[60 64]);
where x (:,6) gives the droplet diameters (sizes) and [60 64] gives the top and bottom edge of the bin.
'Bin' gives out the number of droplets fall in bin 60-64, not the diameter value of those falling within that bin.
I would like to get the droplet value from each bin.
Fangjun Jiang
Fangjun Jiang le 5 Déc 2011
The value would be x(Bin,6)

Connectez-vous pour commenter.

Tags

Question posée :

le 5 Déc 2011

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!

Translated by