Borrar filtros
Borrar filtros

Deleting Rows in a matrix

2 visualizaciones (últimos 30 días)
A
A el 13 de Mzo. de 2021
Comentada: A el 16 de Mzo. de 2021
I have a matrix:
A=[1 2 3;
5 6 7;
9 3 5;
9 5 2;
0 6 2;
7 3 6;
3 5 9;
0 2 4];
And another matrix
P=[1 2 3;
9 3 5;
9 5 2;
0 2 4;
7 3 6];
How can I delete the rows in A that have same elements in P?
For example:
A=[5 6 7;
9 5 2;
0 6 2;
3 5 9];
So the same rows in P are deleted in A

Respuesta aceptada

Walter Roberson
Walter Roberson el 13 de Mzo. de 2021
A=[1 2 3;
5 6 7;
9 3 5;
9 5 2;
0 6 2;
7 3 6;
3 5 9;
0 2 4];
P=[1 2 3;
9 3 5;
9 5 2;
0 2 4;
7 3 6];
setdiff(A, P, 'rows', 'stable')
ans = 3×3
5 6 7 0 6 2 3 5 9
  1 comentario
A
A el 16 de Mzo. de 2021
Thank you so much!!

Iniciar sesión para comentar.

Más respuestas (0)

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!

Translated by