For Loop with two list items at a time rather that one
- From: "Alex " <blue.harvest.83@xxxxxxxxx>
- Date: Thu, 30 Jun 2011 03:43:10 +0000 (UTC)
Is there a way to make a for loop use two items from it's list in every iteration? I need the 1st and 2nd value, then the 3rd and 4th, and so on from the list they are stored in.
I have a scenario where I have a (possible large) list of X locations from a graph that are significant to me, and I want to collect the data between 2 of the points automatically.
changepoint = [8 61 147 218 381 472 533 552]
c((changepoint(1)+1):(changepoint(2)-1)) % c((8+1):(61-1)) since changepoint(1) = 8, and changepoint(2) = 61, reducing to:
% c(9:60) This is what I want, as well as:
% Where c is my original data, and I want to find the values between the % 1st changepoint and the 2nd, then the data between the 3rd changepoint % and the 4th, between the 5th and 6th, and so on.
% Can I automate this with a for loop?
- Prev by Date: Re: Matlab Code to C++ - Copyright/Licensing issues
- Next by Date: Updating Cell Array with listbox & popupmenu options
- Previous by thread: Rendering isosurface results
- Next by thread: For Loop with two list items at a time rather that one