%parseGPS.m

clear;
inFile = ('gps_parse.out');
inFID = fopen(inFile);
i=1;

while ~feof(inFID)
    inString = fgets(inFID);
    inFields = strsplit(inString, '\t', 'CollapseDelimiters', false);
    if (strfind(inFields{39}, 'prof#') > 0); 
        disp(inFields{39});
        inFields2 = strsplit(inFields{39},',','CollapseDelimiters', false);
        t{i}=(inFields2{13});
        latmin(i)=str2double(inFields2{14})-3600;
        lonmin(i)=str2double(inFields2{16})-12100;
        i=i+1;
    end
end

fclose(inFID);

for j=1:(i-1)
    lat(j) = 36 + latmin(j)/60;
    lon(j) = -1*(121 + lonmin(j)/60);
end

kmlwrite('23mar.kml',lat,lon,'Name',t);