Segmenting EMG via a Loop

4 views (last 30 days)
Ryan Chhiba
Ryan Chhiba on 20 Mar 2021
Answered: Star Strider on 20 Mar 2021
I have been using this for loop code to window time data into 20 second segments. I Have been trying to use te same code to segment EMG data into 20 second segments but it does not run. There is no error that pops up, it just does not work. Would anyone have some insight to where I am going wrong? Thanks
Fs= 2048
length_time = length(Processed_EMG.EMG_Processed.Conditioned_EMG.notch_480_DDE_SCM_L);
segment= 20;
n= Fs*segment;
int= floor(length_time/n);
for i= 1:int
win_time_begin(i) = n*(i-1);
win_time_end(i) = n*(i);
win(i,:) = win_time_begin(i):1:win_time_end(i);
end

Accepted Answer

Star Strider
Star Strider on 20 Mar 2021
If the value of ‘int’ is less than 1, the loop counter is satisfied at the outset, and the loop never iterates.
The Signal Processing Toolbox buffer function is what I always use to segment signals. It is just easier than writing my own code.

More Answers (0)

Categories

Find more on MATLAB in Help Center and File Exchange

Tags

Community Treasure Hunt

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

Start Hunting!