function [ splitSignals, code ] = cutSingleWindow( stimulusCodes, signal, params, t )
    changeIndices=cat(1,0,find(diff(double(stimulusCodes))));
    codeCount=diff(changeIndices);
    interval=t*params.SamplingRate.NumericValue;

    splitSignals=[];
    code=[];

    c=codeCount(1)+1;
    %cut windows of 1s
    for i=2:(size(codeCount,1)) %exclude beginning and end (stimulus 0)
        if codeCount(i) >= interval
            splitSignals=cat(3,splitSignals,signal(c:c+interval-1,:));
            code=cat(1,code,double(stimulusCodes(c)));
        end
        c=c+codeCount(i);
    end
end
