I have a 4001x1 matrix ODv (attached) and its 1x4001 timespan vector. As you can see in the attached image, every x milliseconds there is an action potential (in this case, they are the 4 bursts of activity you see where the y value increases from approximately -60mV to positive values).
I am looking for a way to measure how many milliseconds it takes for each action potential (whose number is variable, it might become 5 or 2 or whatever number depending on the conditions) to go from a value of -40mV (this number is the same for all 4 action potentials) to each peak value (this number changes for each action potential: approximately 40, 30, 30 and 30 mV in this image).
So for example I'd need an algorithm that tells me: it took 2 ms for the first AP, 3 ms for the second AP, 1 ms for the third AP and so on.
I would know how to do this for one AP, but not when there is more than one.