function [prc50,prc95,prc99]=percentiles(vector,accuracy)
prc50=[];
prc95=[];
prc99=[];
ptot=[];
vec_sub=[];
index=1;    ind=1;
while ind<length(vector)
    % values under accuracy for at least 10 epochs
    if vector(ind)<accuracy && vector(ind+10)<accuracy
        while ~-isnan(vector(ind))
            vec_sub(index)=vector(ind); %horizontal
            ind=ind+1;
            index=index+1;
        end
        %Horizontal
        prc50=[prc50;prctile(vec_sub,50)];
        prc95=[prc95;prctile(vec_sub,90)];
        prc99=[prc99;prctile(vec_sub,95)];
        ptot=[ptot;vec_sub'];
    end
    ind=ind+1;
end
end