Remove a subset matrix from another matrix

21 Ansichten (letzte 30 Tage)
Sourangsu Chowdhury
Sourangsu Chowdhury am 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

Akzeptierte Antwort

Image Analyst
Image Analyst am 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, :) = []

Weitere Antworten (0)

Tags

Community Treasure Hunt

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

Start Hunting!

Translated by