From: Marco on 27 Mar 2010 20:43 I must delete two or more equal rows in a 2coloumn matrix example : 1--2 1--2 1--3 5--8 5--8 6--7 6--7 7--8 7--8 8--9 I want this output: 1--3 8--9 I try to use unique, but it leaves one of equal rows unique output: 1--2 1--3 5--8 6--7 7--8 8--9 thanks!
From: Matt Fig on 28 Mar 2010 00:29 This seems to work: idx = [~1 all(~diff(A),2)']; idx = strrep(idx,[0 1],[1 1]); A = A(~idx,:)
From: us on 28 Mar 2010 13:05 "Marco " <marcodpc(a)gmail.com> wrote in message <hom8kt$6kr$1(a)fred.mathworks.com>... > I must delete two or more equal rows in a 2coloumn matrix > > example : > 1--2 > 1--2 > 1--3 > 5--8 > 5--8 > 6--7 > 6--7 > 7--8 > 7--8 > 8--9 > > I want this output: > 1--3 > 8--9 > > I try to use unique, but it leaves one of equal rows > unique output: > 1--2 > 1--3 > 5--8 > 6--7 > 7--8 > 8--9 > > thanks! one of the solutions v=[ 1 2 1 2 1 3 3 5 3 5 2 4 2 4 1 2 8 9 ]; [vu,vx,vx]=unique(v,'rows'); vn=histc(vx,1:max(vx)); r=vu(vn==1,:); disp(r); %{ 1 3 8 9 %} us
From: Marco on 4 Apr 2010 18:20 ok, If I use sortrows, it works both solution, than thanks a lot. I have another problem : I need to delete also equal rows in reverse order: example : 1--2 1--2 1--3-------- 2--3 2--5 3--1-------- 5--8-------- 5--8-------- 6--7 6--7 6--8 7--8 7--8 8--5-------- 8--7 8--9 I want this output: 2--3 2--5 6--8 8--9
From: Marco on 6 Apr 2010 06:47 I have solved my last problem with e sort 'ascend' thanks!
|
Pages: 1 Prev: delete more equal rows Next: Phase Correlation(POC) to detect pixel transition |