Path: news.mathworks.com!not-for-mail
From: "Bruno Luong" <b.luong@fogale.findmycountry>
Newsgroups: comp.soft-sys.matlab
Subject: Re: HOWTO: Accelerate processing algorithm
Date: Sun, 5 Jul 2009 16:33:01 +0000 (UTC)
Organization: FOGALE nanotech
Lines: 9
Message-ID: <h2qkjt$c5b$1@fred.mathworks.com>
References: <1e37765c-af3c-49d8-8465-8203f0c78f19@d4g2000yqa.googlegroups.com> <19990901.76079.1246810695595.JavaMail.jakarta@nitrogen.mathforum.org>
Reply-To: "Bruno Luong" <b.luong@fogale.findmycountry>
NNTP-Posting-Host: webapp-03-blr.mathworks.com
Content-Type: text/plain; charset="ISO-8859-1"
Content-Transfer-Encoding: 8bit
X-Trace: fred.mathworks.com 1246811581 12459 172.30.248.38 (5 Jul 2009 16:33:01 GMT)
X-Complaints-To: news@mathworks.com
NNTP-Posting-Date: Sun, 5 Jul 2009 16:33:01 +0000 (UTC)
X-Newsreader: MATLAB Central Newsreader 390839
Xref: news.mathworks.com comp.soft-sys.matlab:552903


 > I have just realized that there might be a problem with 0/0.

You can specify the default value; if you prefer the accumarray-mean to return 0 for empty set; then call

S = accumarray(yp1,v(:))./accumarray(yp1,1,[],[],1);

Personally I prefer NaN for such case.

% Bruno