%**************************************************************************
%This function outputs analysis comparison results to the data file.
%
%Input:
%dat_file, data file for results
%date_num, number giving the date of the measurement
%input_name, name of each dataset
%t_ave, average undulator temperature (C)
%k_eff, Keff for each measurement
%
%Zachary Wolf, 3/30/09

function [] = pid_comp_dat_results(dat_file, date_num, input_name, t_ave, k_eff)

%Open the data file
fid = fopen(dat_file, 'a');

%Write the values to the data file
fprintf(fid, '\r\n\r\n');
fprintf(fid, '          Compare Analysis Results          \r\n');
fprintf(fid, '\r\n');
fprintf(fid, '   Date         Name       Temp      Keff   \r\n');
fprintf(fid, '                            (C)             \r\n');
fprintf(fid, '-----------  -----------  -------  ---------\r\n');
for ii = 1 : length(t_ave)
    fprintf(fid, '%11s  %-11s  %7.3f  %9.6f\r\n', ...
        datestr(date_num(ii), 'dd-mmm-yyyy'), input_name{ii}, t_ave(ii), k_eff(ii));
end
%Close the file
fclose(fid);

%Done
