%resolution_print.m
%prints the results to a .txt file

function resolution_print(Results,path,name,number,proc,imagepath,comma)

[li,col]=size(Results);

fid=fopen([imagepath,'\',name,'_',proc,'.txt'],'a');

fprintf(fid,'Method: \t%s\r',proc);
fprintf(fid,'Lines per Measurement: \t%g',(li+3));
fprintf(fid,'Image:\t%s\r',[path,'\',name]);

for n=1:(number+2)
    if n==1
        fprintf(fid,'Resolution\t');
    elseif n<=(number+1)
        fprintf(fid,'Segment %g\t',(n-1));
    else
        fprintf(fid,'Nyquist-Frequency\r');
    end
end
if comma==0
    for n=1:li
        fprintf(fid,'%10.6f\t',Results(n,1:col-1));
        fprintf(fid,'%10.6f\r',Results(n,col)); 
    end
else

    for n=1:li
    
        str=num2str(Results(n,1:col-1),'%10.6f\t');
        str=strrep(str,'.',',');
        fprintf(fid,'%s',str);
    
        str=num2str(Results(n,col));
        str=strrep(str,'.',',');
        fprintf(fid,'%s\r',str); 
    end
end

fclose(fid);
