Path: news.mathworks.com!not-for-mail
From: "Bruno Luong" <b.luong@fogale.findmycountry>
Newsgroups: comp.soft-sys.matlab
Subject: Re: Index matrix to sparse matrix... saving memory
Date: Mon, 14 Jun 2010 06:07:03 +0000 (UTC)
Organization: FOGALE nanotech
Lines: 8
Message-ID: <hv4gu7$ark$1@fred.mathworks.com>
References: <htrfev$fo7$1@fred.mathworks.com> <htrk32$2vm$1@fred.mathworks.com> <htrlad$in3$1@fred.mathworks.com> <htrmbl$nn6$1@fred.mathworks.com> <hts2hl$3tk$1@fred.mathworks.com> <htt9rq$1s8$1@fred.mathworks.com> <htthum$sg$1@fred.mathworks.com> <httk3s$hb0$1@fred.mathworks.com> <httl5l$ns3$1@fred.mathworks.com> <hum6no$7rt$1@fred.mathworks.com> <hum8vg$65s$1@fred.mathworks.com> <huo80j$c5n$1@fred.mathworks.com> <huoa7s$dt4$1@fred.mathworks.com> <hup2ps$rmb$1@fred.mathworks.com> <huqb73$q0d$1@fred.mathworks.com> <hurcjs$h31$1@fred.mathworks.com> <hurdpc$5ln$1@fred.mathworks.com> <hureus$mfm$1@fred.mathworks.com> <hurg2g$5kt$1@fred.mathworks.com> <hv2qti$j1l$1@fred.mathworks.com> <hv3vug$ar0$1@fred.mathworks.com>
Reply-To: "Bruno Luong" <b.luong@fogale.findmycountry>
NNTP-Posting-Host: webapp-03-blr.mathworks.com
Content-Type: text/plain; charset=UTF-8; format=flowed
Content-Transfer-Encoding: 8bit
X-Trace: fred.mathworks.com 1276495623 11124 172.30.248.38 (14 Jun 2010 06:07:03 GMT)
X-Complaints-To: news@mathworks.com
NNTP-Posting-Date: Mon, 14 Jun 2010 06:07:03 +0000 (UTC)
X-Newsreader: MATLAB Central Newsreader 390839
Xref: news.mathworks.com comp.soft-sys.matlab:644651

Take a look at example 10 of the doc of accumarray:
http://www.mathworks.com/access/helpdesk/help/techdoc/ref/accumarray.html

In this example, the function handle "@(x) {x}" is used to group the "values" as cell per bin.

With something similar you can accomplish the task you want.

Bruno