フィルターのクリア

How to list the values that are contained within each bin

3 ビュー (過去 30 日間)
Kristin
Kristin 2013 年 5 月 29 日
Hi! I have a list of data points (x) that I want to organize by another set of data points (y). I have used the histc function to bin x by y and calculate the mean for each bin, but now I'd like to see what the actual values are in each bin and perhaps even export these values into different columns in excel. I have the xlswrite function working, but I can't seem to access the values of (x) within each y. Is there a function I could use to see these?
Thanks!!! Kristin

採用された回答

Iain
Iain 2013 年 5 月 29 日
You can get a single set via:
c = x( (y>bin_min) & (y < bin_max) );
You will need to provide the bin_min and bin_max, but the histc help should tell you how those are decided.
If you do that in a loop, c will need to be a cell array:
for i = 1:n
c{i} = x( (y>bin_min) & (y < bin_max) );
end

その他の回答 (2 件)

Kristin
Kristin 2013 年 5 月 29 日
By bin_min and bin_max, do you mean topEdge and botEdge as defined by the number of bins or the min, max size of the individual bin?
  1 件のコメント
Iain
Iain 2013 年 5 月 29 日
I mean the boundaries of each bin.

サインインしてコメントする。


Kristin
Kristin 2013 年 5 月 29 日
Thank you!! Worked perfectly with binMembers that was already in the averaging code.

カテゴリ

Help Center および File ExchangeGet Started with MATLAB についてさらに検索

Community Treasure Hunt

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

Start Hunting!

Translated by