Binning Data
8 ビュー (過去 30 日間)
古いコメントを表示
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 件のコメント
回答 (2 件)
Image Analyst
2011 年 7 月 31 日
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 件のコメント
Walter Roberson
2011 年 7 月 31 日
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 件のコメント
参考
カテゴリ
Help Center および File Exchange で Logical についてさらに検索
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!