%**************************************************************************
%This function initializes the plot file.  It writes a title page.
%
%Input:
%plt_file, plot file for results
%in_msg, message describing the plots
%
%Zachary Wolf
%10/13/09, 1/14/15

function [] = util_plot_init_msg(plt_file, in_msg)

%Get time and date information
%c = [y, m, d, h, mi, s]
c = fix(clock);

%Write a header for the title page
msg{1} = sprintf('SLAC Magnetic Measurements\r\n');
msg{2} = sprintf('Date: %02i-%02i-%4i\r\n', c(2), c(3), c(1));
msg{3} = sprintf('Time: %02i:%02i:%02i\r\n', c(4), c(5), c(6));

%Add the input message
msg{4} = sprintf('\r\n');
msg{5} = sprintf('\r\n');
msg = [msg, in_msg];

%Format
msg = strrep(msg, '_', '-');
msg = strrep(msg, '\', '\\');

%Make a title page for the plots
figure;
axes('position', [0, 0, 1, 1], 'visible', 'off');
y_pos = .90;
[r, c] = size(msg);
for ii = 1 : c
    y_pos = y_pos - .03;
    text(.1, y_pos, msg{ii}, 'FontSize', 12);
end

%Plot the title page
util_print_fig_init(plt_file);

%Done
