Path: news.mathworks.com!not-for-mail
From: <HIDDEN>
Newsgroups: comp.soft-sys.matlab
Subject: Removing array dimension
Date: Tue, 30 Apr 2013 23:19:09 +0000 (UTC)
Organization: Boeing Co
Lines: 19
Message-ID: <klpjhd$r11$1@newscl01ah.mathworks.com>
References: <klpght$jh1$1@newscl01ah.mathworks.com>
Reply-To: <HIDDEN>
NNTP-Posting-Host: www-00-blr.mathworks.com
Content-Type: text/plain; charset=UTF-8; format=flowed
Content-Transfer-Encoding: 8bit
X-Trace: newscl01ah.mathworks.com 1367363949 27681 172.30.248.45 (30 Apr 2013 23:19:09 GMT)
X-Complaints-To: news@mathworks.com
NNTP-Posting-Date: Tue, 30 Apr 2013 23:19:09 +0000 (UTC)
X-Newsreader: MATLAB Central Newsreader 756104
Xref: news.mathworks.com comp.soft-sys.matlab:794649

"Jonathan W Smith" wrote in message <klpght$jh1$1@newscl01ah.mathworks.com>...
> Hello
> If I have an array of size 3 x 4 x 5 (3-dimensional array) .
> 
> How do completely remove the 3rd dimension so it will become a size of just 3 x 4 (2-dimensional array).
> 
> Lets say the array is A,  I know I could do B = A(:,:,[]).  However, in this case I would end up with a 3-dimensional array with the 3rd dimension being all zeros.

It is not clear what you want. If you want a specific page, e.g.,

B = A(:,:,1); % the 1st page

If you want a sum, e.g.,

B = sum(A,3); % sums along the 3rd dimension

Maybe you could give a short example of input and desired output.

James Tursa