%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
% THIS PROGRAM IS INTENDED FOR DEMONSTATION OF SGMP      % 
% FORMAT. USAGE OF THIS PROPGRAM IS UNDER USER'S         % 
% RESPONSIBILITY AND NO GUARANTEE IS PROVIDED IN ANY     %
% ASPECT OF THIS PROGRAM.                                %   
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%

% batchPosfixSGMP.m
%---------------------------------------------------------
% Calculate position and clk bias using pr and eph
% By Juyong Do,  Jan 15, 2009
%=========================================================
%=========================================================
clc, clear all, format compact, warning off
paraPosfixSGMP;

%=========================================================
%get list of SGMP files
inputfiles  = dir(opt.inputdir);
temp =[];
for i=1:size(inputfiles,1)    
    filename = inputfiles(i).name;
    if length(filename)>4,
        if isequal(filename(end-3:end),'.mat'), 
            temp = [temp; inputfiles(i)];        
        end;        
    end
end
inputfiles  = temp; clear temp;

if size(inputfiles,1)==0,
    error(['Please, copy SGMP files to "',opt.inputdir,'" directory']);
end
disp(['Processing ',num2str(size(inputfiles,1)),' files from "',opt.inputdir,'" directory...']);

%=========================================================
%process SGMP files
for i=1:size(inputfiles,1)             
    posfixSGMP(inputfiles(i).name);
end

return;
%=========================================================
%=========================================================