function [answer]= threshold(slidewin, thres);

sizewin = size(slidewin,1);

leftsize = (sizewin -1)/2;

meanleft = mean(slidewin([1:leftsize],:));
meanright = mean(slidewin([(leftsize + 2):sizewin],:));

stdleft = std(slidewin([1:leftsize],:));
stdright = std(slidewin([(leftsize + 2):sizewin],:));

 first= meanleft + (thres * sqrt(stdleft));
 second = meanright + (thres * sqrt(stdright));

solution = large(first, second);


if slidewin(leftsize+1,1) > thres
    answer = 1;
else
    answer = 0;
end

return