Remove a subset matrix from another matrix
21 views (last 30 days)
Show older comments
Sourangsu Chowdhury
on 8 Jan 2018
Commented: Sourangsu Chowdhury
on 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
0 Comments
Accepted Answer
Image Analyst
on 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, :) = []
More Answers (0)
See Also
Categories
Find more on Octave in Help Center and File Exchange
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!