Hello Jessica,
You need to create two answer vectors, one for storing the index of “Toe-off” moments, and other for “Heel-down”. A simple for loop can be used for iterating the whole 140th column, along with 2 flags to capture the current state.
If the Heel-down flag ("flag1") is true, then look for the index of first value after current time instant which is less than 5N, and if the Toe-off flag ("flag2") is true, then look for the index of first value after current time instant which is greater than 20N. As soon as the value is found, the corresponding index can be pushed into the respective vector.
![](https://www.mathworks.com/matlabcentral/answers/uploaded_files/1825545/image.png)