Somone can help me with unique and find function?
1 visualización (últimos 30 días)
Mostrar comentarios más antiguos
Rodrigo Franco
el 1 de Jun. de 2020
Comentada: madhan ravi
el 1 de Jun. de 2020
Hello everyone,
I have two matrix A and B and i wanna find the row equals in both matrix and remove the line on matrix B. I wanna safe on the vector the position the lines,How can i do it?
For example:
A = [1 2 6 3;
4 5 6 9;
7 7 7 6;
9 8 7 3];
B = [0 9 6 3;
3 5 1 9;
7 7 7 6;
9 8 9 9];
the row equals is row 3. So i wanna find the rows equal, that's row 3 and leave the matrix B this way:
B = [0 9 6 3;
3 5 1 9;
9 8 9 9];
vector = 3;
Help me
0 comentarios
Respuesta aceptada
madhan ravi
el 1 de Jun. de 2020
[lo,ix]= ismember(A,B,'rows')
B = B(~lo,:)
vector = ix(lo)
1 comentario
madhan ravi
el 1 de Jun. de 2020
ix = all(A == B, 2);
B = B(~ix, :)
vector = find(ix)
Más respuestas (0)
Ver también
Categorías
Más información sobre Creating and Concatenating Matrices 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!