Path: news.mathworks.com!not-for-mail
From: "Dips Bhatia" <deepakdbhatia@gmail.com>
Newsgroups: comp.soft-sys.matlab
Subject: Re: how to create a new matrix from a [n 1] matrix
Date: Thu, 12 Nov 2009 17:18:02 +0000 (UTC)
Organization: The MathWorks, Inc.
Lines: 25
Message-ID: <hdhg0a$2ke$1@fred.mathworks.com>
References: <hdhfbn$m36$1@fred.mathworks.com>
Reply-To: "Dips Bhatia" <deepakdbhatia@gmail.com>
NNTP-Posting-Host: webapp-05-blr.mathworks.com
Content-Type: text/plain; charset="ISO-8859-1"
Content-Transfer-Encoding: 8bit
X-Trace: fred.mathworks.com 1258046282 2702 172.30.248.35 (12 Nov 2009 17:18:02 GMT)
X-Complaints-To: news@mathworks.com
NNTP-Posting-Date: Thu, 12 Nov 2009 17:18:02 +0000 (UTC)
X-Newsreader: MATLAB Central Newsreader 2051836
Xref: news.mathworks.com comp.soft-sys.matlab:584631


"burcu " <burcu102@hotmail.com> wrote in message <hdhfbn$m36$1@fred.mathworks.com>...
> Hi all,
> 
> I have a nx1 matrix and i want to create an axb matrix from this lines by taking the first a columns and setting as column 1, taking next a columns and putting it right of the first a columns etc. 
> An example to be more clear:
> 
> data= a
>          b
>          c
>          d
>          e
>          f
>          g
>          h
> i have 8x1 matrix and i need to get a 2x4 matrix from this like:
>              a c e g
>              b d f h
> Any advice to create such a matrix for a really big number of n?
> 
> Thanks for all the replays!
> 
> Burcu

Use reshape(data,2,4)
See help reshape