Overwriting within loops, not correctly saved

I'm interested in de double support phase (DS phase,%) for my participants. The participants are called by t = 3:length(DATA).
I need the DS phase per stride. For example: data of participant t =3, contains ee=53 strides (length of STRIDE_INFO (stride = right+left here)).
For all the stride, the rows I would like to call by ee which are NOT NaN, the caculations can be made.
for t = 3:length(DATA);
[ww,~] = size(DATA(t).STRIDE_INFO);
for ee = 1:ww
if ~isnan(DATA(t).STRIDE_INFO(ee,2)) ;
Total_stride_time = DATA(t).STRIDE_INFO(ee,8)-DATA(t).STRIDE_INFO(ee,2);
% number of columns (ee,?) represents the different gait events right and left
Double_S2_time = DATA(t).STRIDE_INFO(ee,7)-DATA(t).STRIDE_INFO(ee,4) ;
Double_S2 = (Double_S2_time./(Total_stride_time)*100)
Stance_time_R = DATA(t).STRIDE_INFO(ee,3)-DATA(t).STRIDE_INFO(ee,2);
HS_to_HS = DATA(t).STRIDE_INFO(ee,6)-DATA(t).STRIDE_INFO(ee,2);
Double_S1_time = Stance_time_R - HS_to_HS;
Double_S1 = (Double_S1_time./(Total_stride_time))*100
end
end
DATA(t).DB_supp = [Double_S1 Double_S2];
end
Can someone tell me why this is not resulting in the DS1 and DS2 phase per participant per stride? I know data is somewhere overwritten because I end up with a single value per participant instead of per stride. Is it the place of where I save the DS data in DATA(t).DB_supp? Because I moved it up to check if that solved the problem, but it didn't.

Answers (0)

Categories

Asked:

on 20 Sep 2019

Edited:

on 20 Sep 2019

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!