How to select specific data from array
5 ビュー (過去 30 日間)
古いコメントを表示
Chau Chin Haw
2020 年 12 月 17 日
回答済み: Remy Lassalle-Balier
2020 年 12 月 17 日
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
0 件のコメント
採用された回答
Remy Lassalle-Balier
2020 年 12 月 17 日
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 件のコメント
その他の回答 (0 件)
参考
カテゴリ
Help Center および File Exchange で Matrices and Arrays についてさらに検索
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!