Path: news.mathworks.com!not-for-mail
From: "Rajgopal " <runraj@gmail.com>
Newsgroups: comp.soft-sys.matlab
Subject: Re: Trace array of matrices
Date: Thu, 13 Aug 2009 23:15:20 +0000 (UTC)
Organization: Duisenberg School of Finance
Lines: 9
Message-ID: <h626q8$m9k$1@fred.mathworks.com>
References: <h61tsn$lbo$1@fred.mathworks.com> <h61ut4$1uv$1@fred.mathworks.com> <h61vj2$hqj$1@fred.mathworks.com>
Reply-To: "Rajgopal " <runraj@gmail.com>
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 1250205320 22836 172.30.248.38 (13 Aug 2009 23:15:20 GMT)
X-Complaints-To: news@mathworks.com
NNTP-Posting-Date: Thu, 13 Aug 2009 23:15:20 +0000 (UTC)
X-Newsreader: MATLAB Central Newsreader 1843774
Xref: news.mathworks.com comp.soft-sys.matlab:563269

"Bruno Luong" <b.luong@fogale.findmycountry> wrote in message <h61vj2$hqj$1@fred.mathworks.com>...
> One of many solutions:
> 
> d=A(bsxfun(@plus,(0:size(A,3)-1)*16,(1:5:16).'));
> st = sum(d(:))
> 
> Bruno

Thank you so much. That speeded up my code incredibly!