Hello,
If I have a matrix R = [1 2 3; 4 5 6; 7 8 9; 10 11 12] and another matrix C= [ 1 2 3; 4 5 6] I want to create another matrix which is called B. The value of B is the rest of not matching rows between R and C so B should be B[ 7 8 9; 10 11 12]
I made two for loops but it doesn´t work
for i=1:length(R)
for j=1:length(C)
if C(j,3)==R(i,3)
R(i,:)=[]
end
end
end
Thanks

 채택된 답변

Andrei Bobrov
Andrei Bobrov 2015년 5월 22일
B = setdiff(R,C,'rows')

추가 답변 (0개)

카테고리

도움말 센터File Exchange에서 Logical에 대해 자세히 알아보기

제품

질문:

2015년 5월 22일

댓글:

2015년 5월 22일

Community Treasure Hunt

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

Start Hunting!

Translated by