# Dividing cyclical data in array

4 Ansichten (letzte 30 Tage)
Marc Elmeua am 27 Feb. 2020
Kommentiert: Marc Elmeua am 27 Feb. 2020
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.
##### 0 Kommentare-2 ältere Kommentare anzeigen-2 ältere Kommentare ausblenden

Melden Sie sich an, um zu kommentieren.

### Akzeptierte Antwort

Mohammad Sami am 27 Feb. 2020
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);
end
##### 1 Kommentar-1 ältere Kommentare anzeigen-1 ältere Kommentare ausblenden
Marc Elmeua am 27 Feb. 2020
wow! this worked great! shokran

Melden Sie sich an, um zu kommentieren.

### Kategorien

Mehr zu MATLAB finden Sie in Help Center und File Exchange

### Community Treasure Hunt

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

Start Hunting!

Translated by