Extracting rows with specific condition in MATLAB

6 visualizaciones (últimos 30 días)
Nejc
Nejc el 18 de Mzo. de 2013
Hi, i have a problem. I got two matric dimension mx3 and nx3. For example:
A=[2,2345,1; 2,2344,0; 4, 2345,56 ; 4,2000,1; 2,2346,22; 4,2111,1]
B=[2,2346,22; 2,2344,0; 4, 2314,56 ; 4,2111,1]
Ok, here are two matrix. What I want to do is to look first and second row and find same elements and on basis of this extract matrix C which will contain all rows that dont fit condition.
Example:
2,2346 in A fit 2,2346 from B
2,2345 in A and its not in B. That means the whole row goes to C 2,2345,1
And so on...I tried to this with setxor, but problem is that i look just second column.. Thank you for your help.

Respuesta aceptada

Azzi Abdelmalek
Azzi Abdelmalek el 18 de Mzo. de 2013
Editada: Azzi Abdelmalek el 18 de Mzo. de 2013
A=[2,2345,1; 2,2344,0; 4, 2345,56 ; 4,2000,1; 2,2346,22; 4,2111,1]
B=[2,2346,22; 2,2344,0; 4, 2314,56 ; 4,2111,1]
C=A(~ismember(A(:,1:2),B(:,1:2),'rows'),:)

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