Borrar filtros
Borrar filtros

How to get the number of samples of each bar in histogram?

3 visualizaciones (últimos 30 días)
Wenlong
Wenlong el 3 de Abr. de 2012
Dear all,
I have a mxn matrix where has n samples and each of them have m variables. I use hist(x, 20) to build histograms on each of the n samples.
Now I want to find how many variables that each bar in a histogram contains. What command should I used to achieve this automatically?
Thank you very much for your help.
Best wishes
Long

Respuestas (1)

Wayne King
Wayne King el 3 de Abr. de 2012
Use the output arguments
x = randn(1e3,1);
N = hist(x,20);
N gives you a vector of counts (frequencies) in each bin. If you want the bin centers as well.
[N,bincentr] = hist(x,20);

Categorías

Más información sobre Histograms en Help Center y File Exchange.

Etiquetas

Productos

Community Treasure Hunt

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

Start Hunting!

Translated by