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일

0 개 추천

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개)

Andrei Bobrov
Andrei Bobrov 2015년 12월 6일

0 개 추천

a - your array;
b = unique(a);
[~,idx] = ismember(a,b);

카테고리

도움말 센터File Exchange에서 Creating and Concatenating Matrices에 대해 자세히 알아보기

태그

질문:

2015년 12월 6일

댓글:

2015년 12월 6일

Community Treasure Hunt

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

Start Hunting!

Translated by