Path: news.mathworks.com!not-for-mail
From: <HIDDEN>
Newsgroups: comp.soft-sys.matlab
Subject: Re: averaging
Date: Wed, 23 Sep 2009 11:08:04 +0000 (UTC)
Organization: Erasmus MC
Lines: 25
Message-ID: <h9cvik$hv4$1@fred.mathworks.com>
References: <h9be7r$gh5$1@fred.mathworks.com> <h9cgb0$g2s$1@fred.mathworks.com> <h9cjpo$sma$1@fred.mathworks.com>
Reply-To: <HIDDEN>
NNTP-Posting-Host: webapp-02-blr.mathworks.com
Content-Type: text/plain; charset="ISO-8859-1"
Content-Transfer-Encoding: 8bit
X-Trace: fred.mathworks.com 1253704084 18404 172.30.248.37 (23 Sep 2009 11:08:04 GMT)
X-Complaints-To: news@mathworks.com
NNTP-Posting-Date: Wed, 23 Sep 2009 11:08:04 +0000 (UTC)
X-Newsreader: MATLAB Central Newsreader 870065
Xref: news.mathworks.com comp.soft-sys.matlab:572296


"arich82 " <|a|r|i|c|8|2|@hotmail.com> wrote in message <h9cjpo$sma$1@fred.mathworks.com>...
> "Bruno Luong" <b.luong@fogale.findmycountry> wrote in message <h9cgb0$g2s$1@fred.mathworks.com>...
> > Use similar technique from this thread. Call UNIQUE on the first column if needed:
> > 
> > http://www.mathworks.com/matlabcentral/newsreader/view_thread/261117
> > 
> > Bruno
> 
> ... And had I refreshed my browser before posting, I would have seen that Bruno already solved your problem.
> 
> Sorry for the duplicating the post (but at least I learned something in the process!).
> 
> --

Here is another "oneliner" using cells

% data
A = [23 0.6 ; 12 0.9 ; 12 1.0 ; 23 0.5] ;
% engine
R = cellfun(@mean,group2cell(A(:,2),A(:,1)))

My GROUP2CELL submission can be found here:
http://www.mathworks.com/matlabcentral/fileexchange/11192

Jos