Path: news.mathworks.com!not-for-mail
From: "Bruno Luong" <b.luong@fogale.findmycountry>
Newsgroups: comp.soft-sys.matlab
Subject: Re: Trace array of matrices
Date: Thu, 13 Aug 2009 21:12:02 +0000 (UTC)
Organization: FOGALE nanotech
Lines: 6
Message-ID: <h61vj2$hqj$1@fred.mathworks.com>
References: <h61tsn$lbo$1@fred.mathworks.com> <h61ut4$1uv$1@fred.mathworks.com>
Reply-To: "Bruno Luong" <b.luong@fogale.findmycountry>
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 1250197922 18259 172.30.248.35 (13 Aug 2009 21:12:02 GMT)
X-Complaints-To: news@mathworks.com
NNTP-Posting-Date: Thu, 13 Aug 2009 21:12:02 +0000 (UTC)
X-Newsreader: MATLAB Central Newsreader 390839
Xref: news.mathworks.com comp.soft-sys.matlab:563237


One of many solutions:

d=A(bsxfun(@plus,(0:size(A,3)-1)*16,(1:5:16).'));
st = sum(d(:))

Bruno