From: <HIDDEN>
Newsgroups: comp.soft-sys.matlab
Subject: Re: finding duplicate entires and removing them
Date: Sat, 31 Jan 2009 01:54:01 +0000 (UTC)
Organization: The MathWorks, Inc.
Lines: 15
Message-ID: <gm0avp$flm$>
References: <glvvv9$350$>
Reply-To: <HIDDEN>
Content-Type: text/plain; charset="ISO-8859-1"
Content-Transfer-Encoding: 8bit
X-Trace: 1233366841 16054 (31 Jan 2009 01:54:01 GMT)
NNTP-Posting-Date: Sat, 31 Jan 2009 01:54:01 +0000 (UTC)
X-Newsreader: MATLAB Central Newsreader 1187260
Xref: comp.soft-sys.matlab:515083

"Phanikumar Bhamidipati" <> wrote in message <glvvv9$350$>...
> ......
>   I have an array of containing the two columns of data, first one is the index and the second one is the value. I want to find and remove any entires that have been repeated.
> ......

  Phanikumar, I have assumed here that you meant to only retain rows in which each number differs from all others in the corresponding column.  Looking at Matt's solution I see that his assumption differs in that a row is retained if just the first number is never repeated in that first column.  Now that I think about it, probably Matt guessed the right interpretation, but I will give you my solution anyway just in case you meant it the other way.  There is no way to tell for sure which you meant from your example, and you said only that you wanted to "remove any entires that have been repeated."

 [t,p] = sort(a);
 q1 = 1:n; q1(p(:,1)) = q1;
 q2 = 1:n; q2(p(:,2)) = q2;
 d = diff(t);
 r = [ones(1,2);d]&[d;ones(1,2)];
 b = a(r(q1,1)&r(q2,2),:);

Roger Stafford