I have a data set that I am trying to break up based upon peaks in the data. Essentially I finding the peaks and the corresponding locations. From there I am seperationg the data from loation 1 to 2, 2 to 3, etcc. I will illustrate this with my code below.
Then what I am trying to do is build indivdual vectors from peak 1 to peak 2, peak 2 to peak 3, etc. I can do it by doing the following:
However, there are many peaks, so I need a way to automate this procedure. I have tried several times, but cannot get it to work. I know this should be rather simple I would think. Any help would be great.