function praaterage
[handles.X,handles.Y]=uigetfile({'*.txt','Select txt files'},'Select txt files.','MultiSelect','on');
certainty=zeros(100000,1);
for j=1:size(handles.X,2);
    A=fileread(strcat(handles.Y,handles.X{1,j}));
    i=0;%tracks position in txt file
    t=1;%tracks hundredths of second
    getval=[];
    while(size(A,2)>i)
        if(isequal(A(i+1),'-'))
            getval(t)=NaN;
            i=i+16;
            t=t+1;
        else
            x=A(i+1:i+7);
            getval(t)=str2num(x);
            if(isequal(A(i+7),','))
                i=i+9;
            else
                i=i+8;
            end;
            certainty(t)=certainty(t)+1;
            t=t+1;
        end;
    end;
    allvals(:,j)=getval;
end;
certainty=certainty(1:size(allvals,1));
certainty=certainty/max(certainty);
for j=1:size(allvals,1);
    avgFreq(j)=2.^(nanmedian(log2(allvals(j,:))));
end;
save('avgcontour.mat','avgFreq','certainty');
    
    
