function r = fillnav(instclass, fullfilebase, r)
% r = fillnav(instclass, fullfilebase, r)
% already ran time correction (to aux times) 
% nmea_gps.prl made a file called [a_file,'.mat']

%the file has been read but not concatenated

aux = read_aux(instclass, fullfilebase);

   %fill heading and nav fields
   % these fields don't exist until here 
   % I'm going to assume
   %      - the ue4 logging PC clock matches UTC
   %      - the gga time matches UTC
   %      - the first timestamp from GGA and from a ping are the same

   % 
   

if (isempty(r.dday))
   error('no data in r.dday (fillnavhdg)')
end


goodi = find( ~isnan(aux.ggadday) & ...
             (aux.ggadday >= min(r.dday)) & ....
             (aux.ggadday <= max(r.dday)) );
if (isfield(aux, 'ggadday') & ...
    isfield(aux, 'lon') & ...
    isfield(aux, 'lat'))
   r.nav.txy1 = [r.dday ...
                 table1([aux.ggadday(goodi) aux.lon(goodi)],r.dday) ...
                 table1([aux.ggadday(goodi) aux.lat(goodi)],r.dday) ]';
   r.nav.txy2 = r.nav.txy1;   
end

