Remove a subset matrix from another matrix

21 vues (au cours des 30 derniers jours)
Sourangsu Chowdhury
Sourangsu Chowdhury le 8 Jan 2018
Suppose I have a certain matrix A in form
28 77 145 127
29 77 166 877
30 77 176 822
31 77 232 188
28 78 252 611
29 78 222 112
30 78 236 211
31 78 122 122
where the first two columns are lat and lon resp and the next two are data and another matrix B
28 78 252 611
29 78 222 112
I need to condition on the lat and lon and remove matrix B from matrix A. I could do this with for loop, I need to do it without looping if possible

Réponse acceptée

Image Analyst
Image Analyst le 8 Jan 2018
Try this:
A=[...
28 77 145 127
29 77 166 877
30 77 176 822
31 77 232 188
28 78 252 611
29 78 222 112
30 78 236 211
31 78 122 122]
B=[...
28 78 252 611
29 78 222 112]
[ia, ib] = ismember(A, B, 'rows')
A(ia, :) = []

Plus de réponses (0)

Catégories

En savoir plus sur Octave dans Help Center et File Exchange

Tags

Community Treasure Hunt

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

Start Hunting!

Translated by