Path: news.mathworks.com!not-for-mail
From: "mobileT83 T" <mobileT83@gmail.com>
Newsgroups: comp.soft-sys.matlab
Subject: reshape a matrix (can I use reshape or reshapec?)
Date: Fri, 21 May 2010 01:28:03 +0000 (UTC)
Organization: The MathWorks, Inc.
Lines: 51
Message-ID: <ht4nj3$9nt$1@fred.mathworks.com>
References: <ht3mle$9re$1@fred.mathworks.com> <ht3tfb$aqm$1@fred.mathworks.com>
Reply-To: "mobileT83 T" <mobileT83@gmail.com>
NNTP-Posting-Host: webapp-03-blr.mathworks.com
Content-Type: text/plain; charset=UTF-8; format=flowed
Content-Transfer-Encoding: 8bit
X-Trace: fred.mathworks.com 1274405283 9981 172.30.248.38 (21 May 2010 01:28:03 GMT)
X-Complaints-To: news@mathworks.com
NNTP-Posting-Date: Fri, 21 May 2010 01:28:03 +0000 (UTC)
X-Newsreader: MATLAB Central Newsreader 2360577
Xref: news.mathworks.com comp.soft-sys.matlab:637871

Thank you for the advice, I understand what you are saying, I really need a table... and they would have values corresponding to the values in each M, N, and L dimensions.

Basically I need to take all of M and lay them out like below... in this case they go 1 through 4 and repeat, N on the other hand only changes when a new set of M starts and finally L is a 2d matrix M*NxL.  

this is the new set of matrices I want to make from the 3d matrix...  M and N are indexing L.  
M       N       L
1        1        [random values]
2        1        [random values]
3        1        [random values]
4        1        [random values]
1        2        [random values]
2        2        [random values]
3        2        [random values]
4        2        [random values]

"Matt Fig" <spamanon@yahoo.com> wrote in message <ht3u7u$2u2$1@fred.mathworks.com>...
> Perhaps 
> 
> permute(A,[2 1 3])
> 
> will do what you need.

"Roger Stafford" <ellieandrogerxyzzy@mindspring.com.invalid> wrote in message <ht3tfb$aqm$1@fred.mathworks.com>...
> "mobileT83 T" <mobileT83@gmail.com> wrote in message <ht3mle$9re$1@fred.mathworks.com>...
> > I would like to take a MxNxL matrix and get a M*NxL matrix.  I know I can do this with two for loops
> > 
> > A = MxNxL
> > for ii = 1:N
> > for jj = 1:M
> > 
> > a = A(jj,ii,:);
> > 
> > end
> > end
> > 
> > but I was hoping to you a reshape tool.  And I want to keep the order given in this for loop.
> > 
> > I found this but I don't know if it will help me... maybe I don't get it.
> > http://www.mathworks.com/matlabcentral/fileexchange/20255
> > 
> > Thanks
> > 
> > mobile
> 
>   Do:
> 
>  a = reshape(A,[],L);
> 
>   It is incompatible with the very notion of an M*N by L matrix to have the ordering you give from your for-loops.  If I interpret your for-loop correctly, each set of L entries occurs in the most rapid ordering sequence, followed by the M and then the N entries.  An M*N by L array doesn't work this way.
> 
> Roger Stafford