Path: news.mathworks.com!not-for-mail
From: <HIDDEN>
Newsgroups: comp.soft-sys.matlab
Subject: add all the dimensions
Date: Fri, 4 Sep 2009 03:50:03 +0000 (UTC)
Organization: The MathWorks, Inc.
Lines: 29
Message-ID: <h7q2pb$qen$1@fred.mathworks.com>
Reply-To: <HIDDEN>
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 1252036203 27095 172.30.248.38 (4 Sep 2009 03:50:03 GMT)
X-Complaints-To: news@mathworks.com
NNTP-Posting-Date: Fri, 4 Sep 2009 03:50:03 +0000 (UTC)
X-Newsreader: MATLAB Central Newsreader 1875128
Xref: news.mathworks.com comp.soft-sys.matlab:568268


Hi

I am trying to add the matrices of different dimension together,  ex

a(:,:,1)= 
1 2 3
4 5 6

a(:,:,2) = 
0 0 0
0 0 1

a(:,:,3) = 
1 0 0
0 0 0

some function later gives
b =
2 2 3
4 5 7 

what is the most efficient way of doing this?

Thanks!
Diego