Path: news.mathworks.com!not-for-mail
From: <HIDDEN>
Newsgroups: comp.soft-sys.matlab
Subject: Re: "Unique" row comparison with duplicate row counter
Date: Fri, 10 Sep 2010 03:58:06 +0000 (UTC)
Organization: The MathWorks, Inc.
Lines: 23
Message-ID: <i6cace$sq5$1@fred.mathworks.com>
References: <i6bmj7$t2d$1@fred.mathworks.com>
Reply-To: <HIDDEN>
NNTP-Posting-Host: webapp-02-blr.mathworks.com
Content-Type: text/plain; charset=UTF-8; format=flowed
Content-Transfer-Encoding: 8bit
X-Trace: fred.mathworks.com 1284091086 29509 172.30.248.37 (10 Sep 2010 03:58:06 GMT)
X-Complaints-To: news@mathworks.com
NNTP-Posting-Date: Fri, 10 Sep 2010 03:58:06 +0000 (UTC)
X-Newsreader: MATLAB Central Newsreader 1708920
Xref: news.mathworks.com comp.soft-sys.matlab:669011

Josh,

Try this

[b,u,v] = unique(A(:,1:2),'rows');
c = accumarray(v,A(:,3));
A2 = [b c]

With your example the result is 

A2 =

    -1    -9     1
    -1     9     2
     2    -5     5
     2     6     1
     3     1     1
     3     7     3

So the order of the rows has changed to ascending order but is otherwise as you want.

Hth
Darren