histogram2から数値テーブルを作成したい

5 views (last 30 days)
和也
和也 on 2 Aug 2022
Edited: Hiro Yoshino on 2 Aug 2022
histogram2は2変量頻度分布図に作成されますが、この図から数値テーブルを作成したいと思います。
ヒストグラムからは全体的なデータの分布を把握し、加工用としてテーブルの値をピックアップして利用したいためです。
詳しい方ご回答よろしくお願いします。

Answers (1)

Hiro Yoshino
Hiro Yoshino on 2 Aug 2022
Edited: Hiro Yoshino on 2 Aug 2022
histcount2 を使うと良いかと思います。以下の N でテーブル(行列) を得られます。
https://jp.mathworks.com/help/matlab/ref/histcounts2.html
x = randn(100,1);
y = randn(100,1);
[N,Xedges,Yedges] = histcounts2(x,y)
N = 7×6
0 1 0 0 0 0 0 4 9 4 0 0 0 3 10 9 4 0 1 3 9 13 10 1 0 6 1 7 1 0 0 0 3 0 0 0 0 0 0 0 1 0
Xedges = 1×8
-3 -2 -1 0 1 2 3 4
Yedges = 1×7
-3 -2 -1 0 1 2 3
histogram2(x,y,Xedges,Yedges)

Products


Release

R2019a

Community Treasure Hunt

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

Start Hunting!