how can I delete the matching rows of two matrices?

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

More Answers (0)

Products

Community Treasure Hunt

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

Start Hunting!