Newer
Older
masterarbeit / CD / matlabCode / shiftingPos.m
@Jan-Peter Hohloch Jan-Peter Hohloch on 22 Nov 2016 591 bytes final
function [kinPerSec]=shiftingPos(kin, windowEMG, shiftEMG)
% shiftingPos calculates position in window by taking the mean
    kinPerSec=zeros(fix((max(kin(:,1))-windowEMG*1000)/(shiftEMG*1000)),3);
    for j=1:size(kinPerSec,1)
        tmp=mean(kin(kin(:,1)>(j-1)*shiftEMG*1000 & kin(:,1)<=(j-1)*shiftEMG*1000+windowEMG*1000,2:4));
        i=j;
        while isnan(tmp) %interval is empty, next existen data will be used
            tmp=mean(kin(kin(:,1)>i*shiftEMG*1000 & kin(:,1)<=i*shiftEMG*1000+windowEMG*1000,2:4));
            i=i+1;
        end
        kinPerSec(j,:)=tmp;
    end
end