Remove a subset matrix from another matrix

조회 수: 18 (최근 30일)
Sourangsu Chowdhury
Sourangsu Chowdhury 2018년 1월 8일
댓글: Sourangsu Chowdhury 2018년 1월 8일
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