How to select specific data from array
3 visualizaciones (últimos 30 días)
Mostrar comentarios más antiguos
Chau Chin Haw
el 17 de Dic. de 2020
Respondida: Remy Lassalle-Balier
el 17 de Dic. de 2020
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 comentarios
Respuesta aceptada
Remy Lassalle-Balier
el 17 de Dic. de 2020
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 comentarios
Más respuestas (0)
Ver también
Categorías
Más información sobre Matrices and Arrays en Help Center y File Exchange.
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!