using NI myRIO I obtained an array of intersection points between a signal and a threshold, every two values represent the rise and fall of an inhale and exhale, repectively.
I want to subtract each two values and store them in new arrays, inhale time, exhale time and breath time.
Now i know there's a problem in the loops I made but i don't know how to fix them, please help me. I'm getting the same values of duration, maybe the j is not updating
the attached picture is the signal where the values were obtained from.
breath=[903, 1979, 2313, 3550, 3870, 4947, 5232, 6517, 6867, 7818, 8181, 9512];