Binning data into 1000 bins between values
6 ビュー (過去 30 日間)
古いコメントを表示
Hi all,
I have 75,000 values and I'd like to bin them into 1000 bins between 0.985 and 1.030. Is this possible and if so how?
Regards
Tim
0 件のコメント
回答 (1 件)
Image Analyst
2021 年 9 月 21 日
Description
Y = discretize(X,edges) returns the indices of the bins that contain the elements of X. The jth bin contains element X(i) if edges(j) <= X(i) < edges(j+1) for 1 <= j < N, where N is the number of bins and length(edges) = N+1. The last bin contains both edges such that edges(N) <= X(i) <= edges(N+1).
[Y,E] = discretize(X,N) divides the data in X into N bins of uniform width, and also returns the bin edges E.
[Y,E] = discretize(X,dur), where X is a datetime or duration array, divides X into uniform bins of dur length of time. dur can be a scalar duration or calendarDuration, or a unit of time. For example, [Y,E] = discretize(X,'hour') divides X into bins with a uniform duration of 1 hour.
[___] = discretize(___,values) returns the corresponding element in values rather than the bin number, using any of the previous input or output argument combinations. For example, if X(1) is in bin 5, then Y(1) is values(5) rather than 5. values must be a vector with length equal to the number of bins.
2 件のコメント
Steven Lord
2021 年 9 月 21 日
If you also want the counts of how many elements fall into each bin I'd use histcounts with three outputs.
参考
カテゴリ
Help Center および File Exchange で Histograms についてさらに検索
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!