%**************************************************************************
%This function outputs analysis comparison results to the data file.
%
%Input:
%dat_file, data file for results
%analysis_name, name for the header
%date_num, number giving the date of the measurement
%b_hall, field measured by the hall probe (T)
%b_nmr, field measured by the nmr probe (T)
%b_delta, field difference between the hall probe and the nmr (T)
%
%Zachary Wolf, 4/14/09

function [] = ref_dipole_dat_results(dat_file, analysis_name, date_num, b_hall, b_nmr, b_delta)

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

%Write the values to the data file
fprintf(fid, '\r\n\r\n');
fprintf(fid, '        Reference Dipole Measurements       \r\n');
fprintf(fid, '\r\n');
fprintf(fid, '%s\r\n', analysis_name);
fprintf(fid, '\r\n');
fprintf(fid, '   Date        Bhall       Bnmr     delta B \r\n');
fprintf(fid, '                (T)        (T)        (G)   \r\n');
fprintf(fid, '-----------  ---------  ---------  ---------\r\n');
for ii = 1 : length(b_hall)
    fprintf(fid, '%11s  %9.6f  %9.6f  %9.2f\r\n', ...
        datestr(date_num(ii), 'dd-mmm-yyyy'), b_hall(ii), b_nmr(ii), b_delta(ii) * 1.e4);
end

%Close the file
fclose(fid);

%Done
