How to identifiy similar rows in a matrix ?

조회 수: 1 (최근 30일)
Paul Nanfah
Paul Nanfah 2015년 6월 23일
댓글: Jos (10584) 2015년 6월 23일
hi everbody, I try to identify similar rows in a matrix. I have tried this but it works only wenn the similar rows are next one to another.
t= [1 2;2 3;4 5;5 4;8 7;6 9]
for i= 1:length(t)-1
if t(i,:)==t(i+1,:)
disp('one Match');
else
disp('no match');
end
end
I think the command ismember can do that but I don´t realy know how to implement it.
  댓글 수: 1
Jos (10584)
Jos (10584) 2015년 6월 23일
What do you want to know exactly?
  1. How many rows are identical to row 1?
  2. For each row, how many rows are identical to it?
  3. For each row, which rows are identical to it?
  4. etc.
I am pretty sure you can use UNIQUE and/or ISMEMBER and/or HISTC.

댓글을 달려면 로그인하십시오.

답변 (1개)

Ingrid
Ingrid 2015년 6월 23일
have you tried the function unique with the option 'rows'?

카테고리

Help CenterFile Exchange에서 Creating and Concatenating Matrices에 대해 자세히 알아보기

Community Treasure Hunt

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

Start Hunting!

Translated by