Path: news.mathworks.com!not-for-mail
From: <HIDDEN>
Newsgroups: comp.soft-sys.matlab
Subject: Reshaping
Date: Fri, 15 Oct 2010 01:21:04 +0000 (UTC)
Organization: Boeing Co
Lines: 30
Message-ID: <i98aa0$6j2$1@fred.mathworks.com>
References: <i9876l$hs5$1@fred.mathworks.com>
Reply-To: <HIDDEN>
NNTP-Posting-Host: webapp-02-blr.mathworks.com
Content-Type: text/plain; charset=UTF-8; format=flowed
Content-Transfer-Encoding: 8bit
X-Trace: fred.mathworks.com 1287105664 6754 172.30.248.37 (15 Oct 2010 01:21:04 GMT)
X-Complaints-To: news@mathworks.com
NNTP-Posting-Date: Fri, 15 Oct 2010 01:21:04 +0000 (UTC)
X-Newsreader: MATLAB Central Newsreader 756104
Xref: news.mathworks.com comp.soft-sys.matlab:678567

"Kurt " <rerty258@gmail.com> wrote in message <i9876l$hs5$1@fred.mathworks.com>...
> hello friends,
> 
> i have a matrix I am not sure how to manipulate in order to reshape it.
> The matrix is:
> 
> H =
>              21    11     14     31
>               7     84     29     55
>              40    93      36      1
> 
> I wish to get it reshaped like;
> 
> H = 
>              21    11     7     84    40    93
>              14    31     29   55    36    1
> 
> help would be much appreciated.
> 
> Kurtis

Another method:

reshape(mtimesx(1,reshape(H.',2,2,[]),'T'),2,[])

You can find the mtimesx function on the FEX:

http://www.mathworks.com/matlabcentral/fileexchange/25977-mtimesx-fast-matrix-multiply-with-multi-dimensional-support

James Tursa