Path: news.mathworks.com!not-for-mail
From: <HIDDEN>
Newsgroups: comp.soft-sys.matlab
Subject: Re: permute/reshape
Date: Tue, 17 May 2011 05:57:03 +0000 (UTC)
Organization: The MathWorks, Inc.
Lines: 85
Message-ID: <iqt2nf$apc$1@newscl01ah.mathworks.com>
References: <iqsi2v$o52$1@newscl01ah.mathworks.com> <0a67c9a0-2ac5-4985-affc-33fd3a684e72@x6g2000yqj.googlegroups.com> <cbcffc55-943b-4094-8b23-fc7fe1777212@s11g2000yqj.googlegroups.com> <iqsmdn$6ci$1@newscl01ah.mathworks.com> <iqsnhc$9bt$1@newscl01ah.mathworks.com> <iqsol0$cff$1@newscl01ah.mathworks.com> <iqsp5s$dvg$1@newscl01ah.mathworks.com> <iqsvan$1a3$1@newscl01ah.mathworks.com> <iqt0pj$5fa$1@newscl01ah.mathworks.com> <iqt1ra$4nc$1@speranza.aioe.org>
Reply-To: <HIDDEN>
NNTP-Posting-Host: www-03-blr.mathworks.com
Content-Type: text/plain; charset=UTF-8; format=flowed
Content-Transfer-Encoding: 8bit
X-Trace: newscl01ah.mathworks.com 1305611823 11052 172.30.248.48 (17 May 2011 05:57:03 GMT)
X-Complaints-To: news@mathworks.com
NNTP-Posting-Date: Tue, 17 May 2011 05:57:03 +0000 (UTC)
X-Newsreader: MATLAB Central Newsreader 1423790
Xref: news.mathworks.com comp.soft-sys.matlab:727181

"Nasser M. Abbasi" <nma@12000.org> wrote in message <iqt1ra$4nc$1@speranza.aioe.org>...
> On 5/16/2011 10:24 PM, Jane wrote:
> > Please help me Convert this B to A matrix. I believe this is what I need.
> >
> > A=[1 2 3 4 5 6;
> >     7 8 9 10 11 12;
> >     13 14 15 16 17 18;
> >     19 20 21 22 23 24;
> >     25 26 27 28 29 30;
> >     31 32 33 34 35 36;
> >     37 38 39 40 41 42;
> >     43 44 45 46 47 48;
> >     49 50 51 52 53 54];
> >
> > B=[1 4;
> >     7 10;
> >     13 16;
> >     19 22;
> >     25 28;
> >     31 34;
> >     37 40;
> >     43 46;
> >     49 52;
> >     2  5;
> >     8  11;
> >     14 17;
> >     20 23;
> >     26 29;
> >     32 35;
> >     38 41;
> >     44 47;
> >     50 53;
> >     3  6;
> >     9  12;
> >     15 18;
> >     21 24;
> >     27 30;
> >     33 36;
> >     39 42;
> >     45 48;
> >     51 54]';
> 
> 
> 
> May be
> 
> -------------------------
> N=size(A,2);
> r=arrayfun(@(i) cat(2,A(:,i),A(:,i+N/2))',1:N/2,'UniformOutput',false);
> B=transpose([r{:}])
> ----------------------------
> 
> B =
> 
>       1     4
>       7    10
>      13    16
>      19    22
>      25    28
>      31    34
>      37    40
>      43    46
>      49    52
>       2     5
>       8    11
>      14    17
>      20    23
>      26    29
>      32    35
>      38    41
>      44    47
>      50    53
>       3     6
>       9    12
>      15    18
>      21    24
>      27    30
>      33    36
>      39    42
>      45    48
>      51    54
> 
> --Nasser

Thank you Nasser. That code gives B matrix from A. How can I do that in reverse. Output A. B is known.