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$>
References: <klpght$jh1$>
Reply-To: <HIDDEN>
Content-Type: text/plain; charset=UTF-8; format=flowed
Content-Transfer-Encoding: 8bit
X-Trace: 1367363949 27681 (30 Apr 2013 23:19:09 GMT)
NNTP-Posting-Date: Tue, 30 Apr 2013 23:19:09 +0000 (UTC)
X-Newsreader: MATLAB Central Newsreader 756104
Xref: comp.soft-sys.matlab:794649

"Jonathan W Smith" wrote in message <klpght$jh1$>...
> 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