Remove a subset matrix from another matrix

21 次查看(过去 30 天)
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

采纳的回答

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

更多回答(0 个)

类别

Help CenterFile Exchange 中查找有关 Octave 的更多信息

标签

Community Treasure Hunt

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

Start Hunting!

Translated by