You simply need to truncate the arrays at the first zero, then generate a ramp of equal lenght for the index.
Where is the original data generated? Maybe, instead of using a 2D array, you should have an 1D array of a [cluster containing a 1D array]. Now each motion can have variable lenght and the code can be much simpler.
Attached is one example tha you can modify.
I am not sure how you want to normalize your data (scale from 0..1, divide by the max value, etc.). If you normalize the data, the spline can be outside the range because of loops, so maybe you should normalize the spline and then apply the same transofrm to the data.
If you have a variable number of motions, you should also change the plots programmatically so the spline are lines and the data are points (property nodes).
Message Edited by altenbach on 09-10-2006 11:17 AM