function [ splitSignals, code ] = cutMovements( stimulusCodes, signal )
%cut Trials only, ignore resting phases

noSamplesPerTrial=15000;
% count how many recorded values belong to one trial
changeIndices=[find(diff(double(stimulusCodes)));size(stimulusCodes,1)];
codeCount=[diff(changeIndices); size(stimulusCodes,1)-sum(diff(changeIndices))];

splitSignals=[];
code=[];

c=1;

for i=1:size(codeCount,1)
    if(codeCount(i)==noSamplesPerTrial && stimulusCodes(c)~=0)
        splitSignals=cat(3,splitSignals,signal(c:c+codeCount(i)-1,:));
        code=cat(1,code,stimulusCodes(c));
    end
    c=c+codeCount(i);
end
end

