I have a data of
1 1 2 2
2 2 3 1.5
3 3 4 2.2
4 4 5 6.8
5 4 6 1
6 5 7 5.1
7 6 8 2.5
8 7 9 3.3
9 8 10 2.8
10 8 11 1.4
11 10 12 3.2
12 11 13 2.7
13 12 14 1.9
14 13 15 4.5
i wanted to select and compared data in column 2 and 3 row by row to check if there are repeted data in the following row starting from 1st row
For example,
the data in column 2 and 3, row 1 is 1 & 2
1 & 2 is being compared to second row to check if there is any repeated value in column 2 and 3
value 2 is repeated in row 2 thus the process is repeated to compared value 2 & 3 with value in row 3 column 2 and 3

 채택된 답변

Remy Lassalle-Balier
Remy Lassalle-Balier 2020년 12월 17일

0 개 추천

Hi,
How about comparing the number of rows of your matrix with the number of rows after passing through the unique function:
Tst = [ 1 1 2 2;
2 2 3 1.5;
3 3 4 2.2;
4 4 5 6.8;
5 4 6 1;
6 5 7 5.1;
7 6 8 2.5;
8 7 9 3.3;
9 8 10 2.8;
10 8 11 1.4;
11 10 12 3.2;
12 11 13 2.7;
13 12 14 1.9;
14 13 15 4.5];
AllRowsAreUnique = size( Tst , 1 ) == size( unique( Tst(:,2:3) , 'rows') , 1 );

추가 답변 (0개)

카테고리

도움말 센터File Exchange에서 Data Types에 대해 자세히 알아보기

태그

Community Treasure Hunt

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

Start Hunting!

Translated by