%**************************************************************************
%This function writes a header to the data file.
%
%Input:
%dat_file, data file for results
%header, copy of the header in the input data file
%
%Zachary Wolf, 1/13/06

function [] = util_dat_header_select(dat_file, header)

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

%Write the measurement data file header information
fprintf(fid, '\r\n');
fprintf(fid, 'Measurement File Header Information:\r\n');

%If the header info has the standard format, use relevant pieces
ii = strmatch('Project:', header);
if length(ii) == 1
    fprintf(fid, '%s\r\n', header{ii});
end
ii = strmatch('Magnet Type:', header);
if length(ii) == 1
    fprintf(fid, '%s\r\n', header{ii});
end
ii = strmatch('Magnet Name:', header);
if length(ii) == 1
    fprintf(fid, '%s\r\n', header{ii});
end
ii = strmatch('Serial Number:', header);
if length(ii) == 1
    fprintf(fid, '%s\r\n', header{ii});
end
ii = strmatch('Run Number:', header);
if length(ii) == 1
    fprintf(fid, '%s\r\n', header{ii});
end
ii = strmatch('Measurement Device:', header);
if length(ii) == 1
    fprintf(fid, '%s\r\n', header{ii});
end
ii = strmatch('Operator:', header);
if length(ii) == 1
    fprintf(fid, '%s\r\n', header{ii});
end
ii = strmatch('Comment:', header);
if length(ii) == 1
    fprintf(fid, '%s\r\n', header{ii});
end

%Close the data file
fclose(fid);

%Done
