# Extract data between peaks

조회 수: 7 (최근 30일)
jay yawson 2019년 6월 10일
댓글: Adam Danz 2019년 6월 11일
Hello everyone, I would really appreciate help on solving this problem. I am trying to segment an emg data based on heelstrikes recorded from the accelerometer. I have used the peak to peak to find the location of the heelstrikes. The first peak, third and fifth peak belong to the right foot. The second, fourth,and sixth correspond to the left foot. I would like to extract the data between. Two heelstrikes of the same foot. For example I would like to write a for loop to extract the emg data from peak 1 to peak 3, then peak 3 to peak 5 till the last peak. Here's what I tried to do but it doesn't work. I have showed the extraction portion in the picture attached. Thanks in advance
if true
% clear all
[pks,locs] = findpeaks(ACC,'MinPeakDistance',1000); %find peaks
for p = 1:length(locs)
first_strike = floor(locs(p,:));
third_strike = floor(locs((p+2),:));
acc = EMG1(first_strike:third_strike , p);
end
end

댓글을 달려면 로그인하십시오.

### 채택된 답변

편집: Adam Danz 2019년 6월 10일
This segregates the EMG1 data by every 2 right-foot steps.
rightFootIdx = 1 : 2 : numel(locs);
for i = 1:length(rightFootIdx)-1
acc = EMG1(locs(rightFootIdx(i)):locs(rightFootIdx(i+1)), p);
% ...
end
##### 댓글 수: 7이전 댓글 5개 표시이전 댓글 5개 숨기기
jay yawson 2019년 6월 11일
편집: Adam Danz 2019년 6월 11일
Concerning the same work, I've asked a similar question. I would like to extract the data between two regions. However these two regions are not the peaks and I don't know how to automatically detect that. Do you have any ideas? Kindly take a look if you manage to get some free time off you busy schedule. Many thanks.
I gave it a shot.

댓글을 달려면 로그인하십시오.

### 카테고리

Help CenterFile Exchange에서 Time Series Events에 대해 자세히 알아보기

### Community Treasure Hunt

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

Start Hunting!

Translated by