Removing values form the Matrix
조회 수: 3 (최근 30일)
이전 댓글 표시
Hi, All
i have two matrix matrix A has size 2 62 matrix B has size 10 62
actually the matrix B contains also matrix A
i want to remove the matrix A from matrix B.
How i can do this
댓글 수: 0
채택된 답변
Azzi Abdelmalek
2013년 3월 13일
편집: Azzi Abdelmalek
2013년 3월 13일
for k=1:size(B,1)
if isequal(B(k:k+1,:),A)
idx=k
break
end
end
B(idx:idx+1,:)=[]
댓글 수: 3
추가 답변 (1개)
Andrei Bobrov
2013년 3월 13일
편집: Andrei Bobrov
2013년 3월 13일
in your case:
B = randi(100,10,62);
A = B(4:5,:);
B(end,:) = A(1,:); % your data
[a,ii] = ismember(B,A,'rows');
iii = 1:size(A,1);
i1 = strfind(ii(:)',iii) + iii - 1;
B(i1,:) = [];
댓글 수: 3
참고 항목
카테고리
Help Center 및 File Exchange에서 Multidimensional Arrays에 대해 자세히 알아보기
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!