필터 지우기
필터 지우기

Dividing cyclical data in array

조회 수: 5 (최근 30일)
Marc Elmeua
Marc Elmeua 2020년 2월 27일
댓글: Marc Elmeua 2020년 2월 27일
Hello,
I have acceleration data of diferent segments of a moving horse. I would like to split it so that I have a different array for each of the strides of the horse, so that I can later time normalize each stride and average them to obtain one averaged stride. I can identify each stride by locating the peaks of acceleration of the horse's foot.
Is there an elegant way to split the array in such way?
Thank you so much.

채택된 답변

Mohammad Sami
Mohammad Sami 2020년 2월 27일
Assuming you can get the locations of the peak, you can create an id variable.
% acc = ... m x 1 array
%locationidxofpeak = somefuntion....
strideid = zeros(length(acc),1);
strideid(locationidxofpeak) = 1;
strideid = cumsum(strideid);
% now stride id would be like [0 0 0 0 0 1 1 1 1 1 2 2 2 2 2 ....]
for i = min(strideid):max(strideid)
strideacc = acc(strideid == i);
% your code.
end
  댓글 수: 1
Marc Elmeua
Marc Elmeua 2020년 2월 27일
wow! this worked great! shokran

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

추가 답변 (0개)

카테고리

Help CenterFile Exchange에서 MATLAB에 대해 자세히 알아보기

제품

Community Treasure Hunt

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

Start Hunting!

Translated by