%**************************************************************************
%This function outputs analysis comparison results to the data file.
%
%Input:
%dat_file, data file for results
%input_name, name of each dataset
%int_bx_dz, first integral of Bx (Tm)
%int_by_dz, first integral of By (Tm)
%int_int_bx_dz_dz, second integral of Bx (Tm^2)
%int_int_by_dz_dz, second integral of By (Tm^2)
%phase_integral, phase integral (T^2m^3)
%
%Zachary Wolf, 5/27/12

function [] = ps_comp_dat_results(dat_file, input_name, int_bx_dz, int_by_dz, int_int_bx_dz_dz, int_int_by_dz_dz, phase_integral)

%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, '    Name         I1Bx         I1By         I2Bx         I2By      Phase Int \r\n');
fprintf(fid, '                 (Tm)         (Tm)        (Tm^2)       (Tm^2)      (T^2m^3) \r\n');
fprintf(fid, '-----------  -----------  -----------  -----------  -----------  -----------\r\n');
for ii = 1 : length(input_name)
    fprintf(fid, '%-11s  %11.3e  %11.3e  %11.3e  %11.3e  %11.3e\r\n', ...
        input_name{ii}, int_bx_dz(ii), int_by_dz(ii), int_int_bx_dz_dz(ii), int_int_by_dz_dz(ii), phase_integral(ii));
end
%Close the file
fclose(fid);

%Done
