Binning Data
8 visualizaciones (últimos 30 días)
Mostrar comentarios más antiguos
Hi All,
My question should be fairly simple, but somehow its perplexing me. I have a vector Mw=[5.7593;5.8340;5.9009;5.8001;5.8563]. I want to bin the vector into increments of 0.05 and be able to see which values are inside each bin. I tried the hist function but I will eventually have more data and won't know exactly how many bins I will need. I'd just like be able to bin it within that increment no matter what the data set is. Any suggestions?
thanks,
KL
0 comentarios
Respuestas (2)
Image Analyst
el 31 de Jul. de 2011
Then use the function histc(). You don't need to specify how many bins you'll need. You only need to specify the edges. And by examining the min and max value of your array, you'll have a starting and ending point for the edges array. Of course at that point you'll also know how many 0.05-wide bins you're going to be using.
0 comentarios
Walter Roberson
el 31 de Jul. de 2011
One interpretation:
[B,I,J] = unique(fix(Mw(:) * 20)/20);
sortrows([B(J),Mw(:)])
You have not been clear as to what output you were hoping to see.
0 comentarios
Ver también
Categorías
Más información sobre Logical en Help Center y File Exchange.
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!