フィルターのクリア

"binning" data with 2D coordinates

17 ビュー (過去 30 日間)
Nicole Konforti
Nicole Konforti 2017 年 1 月 26 日
回答済み: Walter Roberson 2017 年 1 月 26 日
I have a set of data points that are stored in a 3x1000 matrix. Each data point has (x, y, z) coordinates. How can I collapse this data into 2D coordinates, and then "bin" the data into a 3D graph?

採用された回答

Walter Roberson
Walter Roberson 2017 年 1 月 26 日
[ux, ~, xidx] = unique(data(1,:));
[uy, ~, yidx] = unique(data(2,:));
%count the number of points at each unique x/y combination
counts = accumarray([xidx(:), yidx(:)], 1);
%average the z that fall into each unique x/y combination
avgs = accumarray([xidx(:), yidx(:)], data(3,:).');
%create a list of the z that fall into each unique x/y combination
zs = accumarray([xidx(:), yidx(:)], data(3,:).', [], @(V) {V}, {});
But perhaps what you want is instead a 2D histogram:
or if you have an older version:

その他の回答 (0 件)

カテゴリ

Help Center および File ExchangeData Distribution Plots についてさらに検索

タグ

Community Treasure Hunt

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

Start Hunting!

Translated by