Path: news.mathworks.com!not-for-mail
From: <HIDDEN>
Newsgroups: comp.soft-sys.matlab
Subject: Indexing into large sparse matrix
Date: Tue, 24 Mar 2009 20:44:02 +0000 (UTC)
Organization: Cornell University
Lines: 6
Message-ID: <gqbgmi$ll6$1@fred.mathworks.com>
Reply-To: <HIDDEN>
NNTP-Posting-Host: webapp-02-blr.mathworks.com
Content-Type: text/plain; charset="ISO-8859-1"
Content-Transfer-Encoding: 8bit
X-Trace: fred.mathworks.com 1237927442 22182 172.30.248.37 (24 Mar 2009 20:44:02 GMT)
X-Complaints-To: news@mathworks.com
NNTP-Posting-Date: Tue, 24 Mar 2009 20:44:02 +0000 (UTC)
X-Newsreader: MATLAB Central Newsreader 1327593
Xref: news.mathworks.com comp.soft-sys.matlab:527398


I have a large sparse matrix with number of elements exceeding the maximum variable size allowed in matlab (though number of rows and columns do not) e.g. A = sparse([],[],[],10e6,10e6,0))

I have a list of row indices r, and colomn indices c (numel(r)==numel(c)).  I would like to extract the elements A(r(i),c(i)) for i=1:numel(r).  For a small matrix I could index as A(sub2ind(size(A),r,c)), however for large A I get the error that it can't index into A since "maximum variable size allowed by the program is exceeded".  I was wondering if there was a way to extract these values without looping over the r, c index.

Thanks,
Nick