find simlar number in array
2 ビュー (過去 30 日間)
古いコメントを表示
if i have a big array (ex: 4x58) and there are some simalr numbers on it. i want to find how many each number on the array has been repeted. how can matlab help me on that? could you explain step by step please?
1 件のコメント
Matt Kindig
2012 年 11 月 9 日
編集済み: Matt Kindig
2012 年 11 月 9 日
Do you mean similar numbers (as in within a certain threshold apart) or identical numbers? If identical, you can use the hist() function.
doc hist
回答 (1 件)
Matt Fig
2012 年 11 月 9 日
編集済み: Matt Fig
2012 年 11 月 9 日
Similar or identical? Those are different! .5 is similar to .6, but not identical.
If you mean identical, you can count how many times each number occurs like this:
A = randi(30,5,5)
N = unique(A(:));
N(:,2) = histc(A(:),N)
参考
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!