Finding Of Same Values in Matrix

3 ビュー (過去 30 日間)
Volkan Yangin
Volkan Yangin 2015 年 12 月 6 日
コメント済み: Volkan Yangin 2015 年 12 月 6 日
Hi everbody
I have a matrix includes 1724 values, i want to find which elements are same in this matrix (For ex. 25. and 426. values are same etc.)
How can i make this?
Thanks..

採用された回答

Image Analyst
Image Analyst 2015 年 12 月 6 日
What about using unique and a brute force approach:
m = randi(10, 1, 100) % Sample data.
allValues = unique(m); % Find unique numbers.
for k = 1 : length(allValues)
thisValue = allValues(k);
indexes{k} = find(m == thisValue);
fprintf('The number %f is found at indexes : ', thisValue);
fprintf('%d ', indexes{k});
fprintf('\n');
end
% celldisp(indexes)
  1 件のコメント
Volkan Yangin
Volkan Yangin 2015 年 12 月 6 日
Thank you for answer, Image Analyst.

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

その他の回答 (1 件)

Andrei Bobrov
Andrei Bobrov 2015 年 12 月 6 日
a - your array;
b = unique(a);
[~,idx] = ismember(a,b);
  1 件のコメント
Volkan Yangin
Volkan Yangin 2015 年 12 月 6 日
Thank you, Andrei Bobrov.

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

カテゴリ

Help Center および File ExchangeLogical についてさらに検索

タグ

Community Treasure Hunt

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

Start Hunting!

Translated by