So, I am working with a binairy variable. To identify the onset of a muscle the binairy variable needs to be '1' for at least 25 samples consecutive.
it sometimes occures that the variable is '1' for 40 samples than '0' for few samples and then '1' again for more than 25 samples. Now i have MATLAB code where i can identify the index for the first string of 25 samples '1', but I can not seem to get the first index for the second string of 25 or more samples '1'.
is there anybody that can help me out?
here is my matlab code so far(including creating the binairy variable):
%create binairy variableex_threshold_preDC2= prestroke1(:,3) > threshold(:,3);%initialisingones_window = ones(1,25);for idx = 1:length(ex_threshold_preDC2)-25window_preDC2 = ex_threshold_preDC2(idx:idx+24);if window_preDC2==ones_windowindex_preDC2 = idx;endend
However, this only gives me the index of the last iteration of the for loop. but I want all iteration saved.