omit rows from matrix

14 visualizaciones (últimos 30 días)
NA
NA el 24 de Nov. de 2018
Editada: madhan ravi el 24 de Nov. de 2018
A=[1,2;1,3;1,4;1,5;2,4;2,3;2,5]
B=[2,4]
I want to omit B from matrix A
answer
A=[1,2;1,3;1,4;1,5;2,3;2,5]

Respuesta aceptada

madhan ravi
madhan ravi el 24 de Nov. de 2018
Editada: madhan ravi el 24 de Nov. de 2018
>> A=[1,2;1,3;1,4;1,5;2,4;2,3;2,5];
B=[2,4];
idx=ismember(A,B,'rows');
A = A(~idx,:)
A =
1 2
1 3
1 4
1 5
2 3
2 5
>>

Más respuestas (0)

Categorías

Más información sobre Creating and Concatenating Matrices en Help Center y File Exchange.

Etiquetas

Community Treasure Hunt

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

Start Hunting!

Translated by