Binning Data
8 Ansichten (letzte 30 Tage)
Ältere Kommentare anzeigen
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 Kommentare
Antworten (2)
Image Analyst
am 31 Jul. 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 Kommentare
Walter Roberson
am 31 Jul. 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 Kommentare
Siehe auch
Kategorien
Mehr zu Logical finden Sie in Help Center und File Exchange
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!