From: Maxx Chatsko on 12 Jul 2010 14:22 Hello all, Suppose I have a double with 15 rows. I want to take data from the first four lines in every set of five and skip the fifth row. How can I express this in a for loop? Thanks Maxx
From: ImageAnalyst on 12 Jul 2010 14:24 Maxx" Do you want each iteration to take 4 rows and skip the 5th, OR do you want that to happen over 5 iterations (so that you're only taking one row per iteration)?
From: Andy on 12 Jul 2010 14:30 "Maxx Chatsko" <chatskom(a)chemimage.com> wrote in message <i1fmgd$hs8$1(a)fred.mathworks.com>... > Hello all, > Suppose I have a double with 15 rows. I want to take data from the first four lines in every set of five and skip the fifth row. How can I express this in a for loop? Thanks > Maxx A for loop can run over any array, not just a consecutive array. That is, instead of: for ix = 1:15 ... end you can use: for ix = [1:4 6:9 11:14] % only first four of each five indices ... end
From: Ashish Uthama on 12 Jul 2010 14:31 On Mon, 12 Jul 2010 14:22:05 -0400, Maxx Chatsko <chatskom(a)chemimage.com> wrote: > Hello all, > Suppose I have a double with 15 rows. I want to take data from the > first four lines in every set of five and skip the fifth row. How can I > express this in a for loop? Thanks > Maxx Do you need a FOR loop? It would have helped to give more context. If the data is not large, you could do this: a=(1:15)' %example data with 15 rows b=a; %make a copy b(5:5:end,:)=[] %delete every 5th row
From: Maxx Chatsko on 12 Jul 2010 14:35 ImageAnalyst <imageanalyst(a)mailinator.com> > Maxx" > Do you want each iteration to take 4 rows and skip the 5th, OR do you > want that to happen over 5 iterations (so that you're only taking one > row per iteration)? I would like to take 4 rows and skip the 5th for each iteration.
|
Next
|
Last
Pages: 1 2 Prev: Intersection of 3D Spline with Plane Next: Can you put a title directly on a legend? |