Path: news.mathworks.com!not-for-mail
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$1@fred.mathworks.com>
References: <glvvv9$350$1@fred.mathworks.com>
Reply-To: <HIDDEN>
NNTP-Posting-Host: webapp-03-blr.mathworks.com
Content-Type: text/plain; charset="ISO-8859-1"
Content-Transfer-Encoding: 8bit
X-Trace: fred.mathworks.com 1233366841 16054 172.30.248.38 (31 Jan 2009 01:54:01 GMT)
X-Complaints-To: news@mathworks.com
NNTP-Posting-Date: Sat, 31 Jan 2009 01:54:01 +0000 (UTC)
X-Newsreader: MATLAB Central Newsreader 1187260
Xref: news.mathworks.com comp.soft-sys.matlab:515083

"Phanikumar Bhamidipati" <phanibhamidipati.remove@gmail.com> wrote in message <glvvv9$350$1@fred.mathworks.com>...
> ......
>   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