MATLAB: How do i separate running data

biomechanicsrunning

Hey,
i have measured running on a treadmill with an integrated pressure sensor and i get an output from both the left and right foot. The thing is, i only want to use the data from the right foot, so i need a way to discard the data from the left foot and keep the right (like replacing all left foot data with 0). I'm quite new to matlab, so i have absolutely no idea how to do it. I have an idea with setting a threshold to 20 newton, and then using a counter to distinguish whenever i'm getting to the start of a new data series (it gets to zero after every step). The test protocol is made so that the first step is always the right, so figuring out which data peak is which foot, is not the problem. If this made no sense at all, please say so, and i will try to elaborate.
I've added the data file, for you to mess around with, if that is any help.
Thank you 🙂

Best Answer

This is actually a really fun job for a new user. Please look into logical indexing https://nl.mathworks.com/help/matlab/math/matrix-indexing.html#bq7eg38 . I actually separated your data, but it was so fun to do I wouldn't want to ruin it for you by spoiling the answer. Your data is very nice, because it's already noise-free so it should be quite doable. If you can't manage just message me and I'll send you my code.
Hint: use something like
starts = find(data(2:end)>0 & data(1:end-1)==0) + 1;
to find the start positions.