Path: news.mathworks.com!not-for-mail
From: <HIDDEN>
Newsgroups: comp.soft-sys.matlab
Subject: Re: Contracting Matrices
Date: Sat, 27 Dec 2008 21:32:01 +0000 (UTC)
Organization: The MathWorks, Inc.
Lines: 23
Message-ID: <gj66sh$dfj$1@fred.mathworks.com>
References: <gj5ksv$1mq$1@fred.mathworks.com> <gj5o9m$n2n$1@fred.mathworks.com> <gj5tat$jb2$1@fred.mathworks.com> <gj65bp$dhc$1@fred.mathworks.com>
Reply-To: <HIDDEN>
NNTP-Posting-Host: webapp-02-blr.mathworks.com
Content-Type: text/plain; charset="ISO-8859-1"
Content-Transfer-Encoding: 8bit
X-Trace: fred.mathworks.com 1230413521 13811 172.30.248.37 (27 Dec 2008 21:32:01 GMT)
X-Complaints-To: news@mathworks.com
NNTP-Posting-Date: Sat, 27 Dec 2008 21:32:01 +0000 (UTC)
X-Newsreader: MATLAB Central Newsreader 1431729
Xref: news.mathworks.com comp.soft-sys.matlab:508921

"Roger Stafford" <ellieandrogerxyzzy@mindspring.com.invalid> wrote in message <gj65bp$dhc$1@fred.mathworks.com>...
> "Philosophaie" <ertlejack@sbcglobal.net> wrote in message <gj5tat$jb2$1@fred.mathworks.com>...
> > >  temp = reshape(Riemann,4,4,[],1);
> > >  Ricci = squeeze(sum(temp(:,:,1:4+1:4*4,1),3));
> > >  disp(Ricci(:,:))
> > this produces a 1x4 matrix
> > What am I doing wrong?
> 
>   I would suggest doing the 'size' operator at each stage.  You should get these results:
> 
>  size(Riemann) --> [4 4 4 4]
>  size(temp) --> [4 4 16 1]
>  size(temp(:,:,1:4+1:4*4,1)) --> [4 4 4 1]
>  size(sum(temp(:,:,1:4+1:4*4,1),3)) --> [4 4 1 1]
>  size(Ricci) --> [4 4]

My results were:
size(Riemann) --> [4 4 4 4]
size(temp) --> [4 4 16]
size(sum(temp(:,:,1:4+1:4*4,1),3)) --> [4 1]
size(Ricci) --> [4 1]

What does the "3" do in the sum command.  Where am I going wrong?