Path: news.mathworks.com!not-for-mail
From: <HIDDEN>
Newsgroups: comp.soft-sys.matlab
Subject: Re: average if: average values in column if values in other colum are equal
Date: Fri, 15 Jul 2011 18:52:07 +0000 (UTC)
Organization: Xoran Technologies
Lines: 6
Message-ID: <ivq28n$5qi$1@newscl01ah.mathworks.com>
References: <ivpqne$cbd$1@newscl01ah.mathworks.com>
Reply-To: <HIDDEN>
NNTP-Posting-Host: www-02-blr.mathworks.com
Content-Type: text/plain; charset=UTF-8; format=flowed
Content-Transfer-Encoding: 8bit
X-Trace: newscl01ah.mathworks.com 1310755927 5970 172.30.248.47 (15 Jul 2011 18:52:07 GMT)
X-Complaints-To: news@mathworks.com
NNTP-Posting-Date: Fri, 15 Jul 2011 18:52:07 +0000 (UTC)
X-Newsreader: MATLAB Central Newsreader 1440443
Xref: news.mathworks.com comp.soft-sys.matlab:736435

"Daphne" <daphnew_too_nospam@yahoo.com> wrote in message <ivpqne$cbd$1@newscl01ah.mathworks.com>...
> 
> I would like to average values in column 2 of a matrix that correspond to equal (and unique) values in column 1, a simple example:
================

 accumarray(a(:,1),a(:,2))./accumarray(a(:,1),1)