hist problem

4 ビュー (過去 30 日間)
Mohammad Golam Kibria
Mohammad Golam Kibria 2011 年 7 月 10 日
I have the following code:
out=I(outPixel);
[counts,values] = hist(transpose(out),unique(out));
Frequency=[counts,values];
where out=
25
25
25
outPixel =
9
980
1174
counts
counts =
Columns 1 through 16
0 0 0 0 0 0 0 0 0 0 0 0 3 0 0 0
Columns 17 through 25
0 0 0 0 0 0 0 0 0
values =
Columns 1 through 15
13 14 15 16 17 18 19 20 21 22 23 24 25 26 27
Columns 16 through 25
28 29 30 31 32 33 34 35 36 37
why so many values in counts and values? what's wrong with me? and Frequency have 101 values I dont know? I need unique value frequency in out. can any body help?

採用された回答

Paulo Silva
Paulo Silva 2011 年 7 月 10 日
unique(out) gives 25, that means you ask for 25 bins, you can see it because you get counts and values with 25 elements.
do it like this:
[counts,values] = hist(transpose(out),numel(unique(out)));
  2 件のコメント
Mohammad Golam Kibria
Mohammad Golam Kibria 2011 年 7 月 10 日
this time it is working. But Im unable to assign [counts,values] values in another matrix 'Frequency'
Mohammad Golam Kibria
Mohammad Golam Kibria 2011 年 7 月 10 日
Its ok no problem.thanks

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

その他の回答 (0 件)

カテゴリ

Help Center および File ExchangeSurface and Mesh Plots についてさらに検索

タグ

Community Treasure Hunt

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

Start Hunting!

Translated by