# how to delete particular row in given matrix ?

1 view (last 30 days)
Arul prasath on 4 Nov 2014
Edited: Arul prasath on 4 Nov 2014
like this matrix
a=[190.6412 159.7899 0.9991];
b=[180.1084 166.6349 0.9992
190.6412 159.7899 0.9991
179.5966 155.4710 1.0000
196.5314 166.2689 1.0000];
than the answer should be like this
c= [180.1084 166.6349 0.9992
179.5966 155.4710 1.0000
196.5314 166.2689 1.0000];
i should delete only 'a' matrix from the 'b' matrix and display as 'c' matrix

Azzi Abdelmalek on 4 Nov 2014
Edited: Azzi Abdelmalek on 4 Nov 2014
c=setdiff(b,a,'rows')
Matt Tearle on 4 Nov 2014
You seem to be saying that the number of columns of b will vary, but above you also said that 'b' will be like 'nx3 matrix', which means that b will always have 3 columns. And the example you keep showing has 3 columns.
So, again, you need to tell us what behavior you expect for b: should b always have 3 columns, or can the number of columns of b change?

the cyclist on 4 Nov 2014
Here's one way:
tf = ismember(b,a,'rows')
c = b(not(tf),:)
Arul prasath on 4 Nov 2014
it's showing Error "A and S must have the same number of columns." in my case 'a' matrix will be same but 'b'matrix will get varies.