Path: news.mathworks.com!not-for-mail
From: <HIDDEN>
Newsgroups: comp.soft-sys.matlab
Subject: Reshaping Dataset
Date: Thu, 25 Jun 2009 21:09:02 +0000 (UTC)
Organization: The MathWorks, Inc.
Lines: 42
Message-ID: <h20p1e$1nf$1@fred.mathworks.com>
References: <h20j9k$9ok$1@fred.mathworks.com> <h20o76$864$1@fred.mathworks.com>
Reply-To: <HIDDEN>
NNTP-Posting-Host: webapp-03-blr.mathworks.com
Content-Type: text/plain; charset="ISO-8859-1"
Content-Transfer-Encoding: 8bit
X-Trace: fred.mathworks.com 1245964142 1775 172.30.248.38 (25 Jun 2009 21:09:02 GMT)
X-Complaints-To: news@mathworks.com
NNTP-Posting-Date: Thu, 25 Jun 2009 21:09:02 +0000 (UTC)
X-Newsreader: MATLAB Central Newsreader 1529481
Xref: news.mathworks.com comp.soft-sys.matlab:550733


"Jos " <#10584@fileexchange.com> wrote in message <h20o76$864$1@fred.mathworks.com>...
> "Jeremy Bing" <jeremy@mytrashmail.com> wrote in message <h20j9k$9ok$1@fred.mathworks.com>...
> > Hi,
> > 
> > I have data in the form of the following.
> > 
> > X Y Z X Y Z  >>
> > X Y Z X Y Z 
> > X Y Z X Y Z 
> > X Y Z X Y Z 
> > ...
> > 
> > But i need the data to be:
> > 
> > X Y Z
> > X Y Z
> > X Y Z
> > 
> > Do i used a case statement or a nested forloop to reshape the data? The dataset is quite large.
> 
> If I understand this correctly, you need column 4-6 to appear below column 1-3? 
> 
> B = [A(:,1:3) ; A(:,4:6)] ;
> 
> hth
> Jos

Hi,

I need column(4,1:3) put underneath 1:3. i used this method:
 
r2 = numel(r(:,1));

for iii = 1:r2
kdkrm(1:21,1:3) = [r(iii,1:3);r(iii,4:6);r(iii,7:9);r(iii,10:12);r(iii,13:15);r(iii,16:18);r(iii,19:21);r(iii,22:24);r(iii,25:27);r(iii,28:30);r(iii,31:33);r(iii,34:36);r(iii,37:39);r(iii,40:42);r(iii,43:45);r(iii,46:48);r(iii,49:51);r(iii,52:54);r(iii,55:57);r(iii,58:60);r(iii,61:63)];
end

but it is quite long and this only deals with the first row. all other rows under also need to go through this so i think i need a nested forloop.

Thanks

Jeremy