Path: news.mathworks.com!not-for-mail
From: <HIDDEN>
Newsgroups: comp.soft-sys.matlab
Subject: sparse matrix assembly without adding duplicate values
Date: Sun, 20 Sep 2009 10:04:02 +0000 (UTC)
Organization: The MathWorks, Inc.
Lines: 12
Message-ID: <h94umi$nrk$1@fred.mathworks.com>
Reply-To: <HIDDEN>
NNTP-Posting-Host: webapp-05-blr.mathworks.com
Content-Type: text/plain; charset="ISO-8859-1"
Content-Transfer-Encoding: 8bit
X-Trace: fred.mathworks.com 1253441042 24436 172.30.248.35 (20 Sep 2009 10:04:02 GMT)
X-Complaints-To: news@mathworks.com
NNTP-Posting-Date: Sun, 20 Sep 2009 10:04:02 +0000 (UTC)
X-Newsreader: MATLAB Central Newsreader 1337510
Xref: news.mathworks.com comp.soft-sys.matlab:571602


Hi

I have three vectors

i_row, j_col, s_val

which I use for assemblying a sparse matrix.
Usually the sparse command  adds any elements of s that have duplicate values of i and j together.  However I dont want to add up duplicate values. I just want to take the first occurence.

Is there a simple way to way to remove duplicate entries. I tried to come up with something using "unique", but it didnt work. Any other ideas...?

Thanks