Path: news.mathworks.com!not-for-mail
From: <HIDDEN>
Newsgroups: comp.soft-sys.matlab
Subject: averaging
Date: Tue, 22 Sep 2009 21:06:03 +0000 (UTC)
Organization: The MathWorks, Inc.
Lines: 10
Message-ID: <h9be7r$gh5$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 1253653563 16933 172.30.248.35 (22 Sep 2009 21:06:03 GMT)
X-Complaints-To: news@mathworks.com
NNTP-Posting-Date: Tue, 22 Sep 2009 21:06:03 +0000 (UTC)
X-Newsreader: MATLAB Central Newsreader 1181469
Xref: news.mathworks.com comp.soft-sys.matlab:572186


I know it can be done in one line. But I am not sure how to do it. Anybody please?
I have a matrix. Say,
col1 col2
23 0.6
12 0.9
12 1.0 
23 0.5
how to average col2 so that it averages by the same id number represented by col1 i.e it should give me the column of [(0.6+0.5)/2 ; (0.9+0.1)/2]. Thanks so much.