%**************************************************************************
%This function gets the run number from the header of the
%undulator data file.
%
%Input:
%header, header from the undulator data file
%
%Output:
%run, run number
%
%Zachary Wolf
%6/30/16

function [run] = util_get_run_header(header)

%Initialize
run = 0;
        
%Find the comment
[r, c] = size(header);
for ii = 1 : c
    if strfind(header{ii}, 'Run Number:') > 0
        run_str = header{ii};
        break;
    end
end

%Get the run number
[run, count] = sscanf(run_str, 'Run Number: %i');
if count ~= 1
    %error(['Could not read run number from header: ', run_str]);
    return;
end

%Done
