From: <HIDDEN>
Newsgroups: comp.soft-sys.matlab
Subject: Re: Data Manipulation (Re-arranging) and Writing to text file
Date: Thu, 28 Jun 2012 01:37:09 +0000 (UTC)
Organization: The MathWorks, Inc.
Lines: 34
Message-ID: <jsgcg5$dnr$>
References: <jrm6nb$787$> <jrmb7j$5iu$> <jrnf37$nlk$> <jrno98$luu$> <jro45e$lh6$> <jrrp0t$8a$> <jrsduv$f2d$> <jrshf8$oev$> <jrvbq3$cqf$> <jrvq6g$qfd$> <js1sa4$ir6$>
Reply-To: <HIDDEN>
Content-Type: text/plain; charset=UTF-8; format=flowed
Content-Transfer-Encoding: 8bit
X-Trace: 1340847429 14075 (28 Jun 2012 01:37:09 GMT)
NNTP-Posting-Date: Thu, 28 Jun 2012 01:37:09 +0000 (UTC)
X-Newsreader: MATLAB Central Newsreader 3536503
Xref: comp.soft-sys.matlab:772358

My apologies. I re-read through the original post. As you indicated, there was a mistake with the boundary condition.

The boundary condition is actually 186.i.e. there are exactly 186 elements in the row vector (62 X 3).
So, based on this, I changed that last line to i1 = i2+1. I then went through the loop as you suggested and here is what I have come up with:

i1 = 1, i2 = i1 + 59 = 1 + 59 = 60
fprintf prints elements 1-60 on rows 1 to 10
on the 11th row, it prints 61 and 62
This is the end of loop1

i1 = 63, i2 = 122
fprintf prints elements 63-123 on rows 12 to 21
on the 22nd row, it prints 61 and 62
This is the end of loop2

i1 = 125, i2 = 125 + 59 = 184
fprintf prints elements 125-184 on rows 23 to 32
on the 33rd row, it prints 185 and 186
This is the end of loop3

i1=187 ? this is > length(x) so the loop exits.

fprintf is done printing.

That is it for this vector, x. I would repeat the exact same process for 4 other vectors.

If this makes sense, it would give me the desired output (same as what I displayed above – 3 blocks of 62). Does this seem reasonable or have I mis-accounted for the boundary condition?

Also, regarding (i1+62)<length(x):
This would no longer be needed. Is this correct or is the loop not going to exit correctly?