Path: news.mathworks.com!not-for-mail
From: "Sudheer Tumu" <tumusudheer@gmail.com>
Newsgroups: comp.soft-sys.matlab
Subject: Getting indexes of rows of matrix with more than n repetitions
Date: Tue, 5 Jan 2010 03:57:02 +0000 (UTC)
Organization: The MathWorks, Inc.
Lines: 34
Message-ID: <hhudae$4p$1@fred.mathworks.com>
Reply-To: "Sudheer Tumu" <tumusudheer@gmail.com>
NNTP-Posting-Host: webapp-05-blr.mathworks.com
Content-Type: text/plain; charset=UTF-8; format=flowed
Content-Transfer-Encoding: 8bit
X-Trace: fred.mathworks.com 1262663822 153 172.30.248.35 (5 Jan 2010 03:57:02 GMT)
X-Complaints-To: news@mathworks.com
NNTP-Posting-Date: Tue, 5 Jan 2010 03:57:02 +0000 (UTC)
X-Newsreader: MATLAB Central Newsreader 2100016
Xref: news.mathworks.com comp.soft-sys.matlab:596484

Hi All,

I have two dimensional matrix with more than 10 million rows. 
I want to get the indexes of rows which are repeted more than n times. n should be passed as argument.

Eg: A=[1 2
           3 4
           5 6
           1 2
           1 2
           3 4   
           1 2
           5 6
           7 8
           1 2
           3 4]
I want result like this by passing n=3 as parameter
Result=[1 2 4 5 6 7 10 11] Since [ 1 2] and [3 4] are the only rows which are repeated more than 3 times. Is there any way to do this without using loops.
I am using loops which is taking nearly 30 mins to get the solution.

This is what I am doing: 
for i=min(A(:,1)):max(A(:,1))
    a1=find(A(:,1)==i);
    for j=min(A(:,2)):max(A(:,2))
        a2=find(A(a1(:),2)== j);
        
        if size(a2,1) >= n
        end
   end
end


Thank you,
Sudheer Tumu.