[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: Efficient unique/sum column(s)
From: |
c. |
Subject: |
Re: Efficient unique/sum column(s) |
Date: |
Wed, 5 Feb 2014 13:59:22 +0100 |
On 5 Feb 2014, at 08:13, Jeremy Ardley <address@hidden> wrote:
> Hi,
>
> I have a matrix A with columns x,y,c. Pairs of x,y repeat often.
>
> My objective is to efficiently sum all values of c for each unique x,y pair
> and generate output matrix B with x,y,csum columns
>
> Any advice appreciated.
does this help:
a = sparse (x(:); y(:), c(:), max(x), max(y));
[x, y, z] = find (a);
c.