資源簡(jiǎn)介
解碼gga數(shù)據(jù),讀出數(shù)據(jù),包括時(shí)間、經(jīng)緯度坐標(biāo)、衛(wèi)星數(shù)、HDOP等信息
代碼片段和文件信息
function?[data]?=?decode_NMEA_GGA(file)
????format?long?g
????fid?=?fopen(file‘r‘);
????%?只讀到最后一個(gè)M
????rawdata?=?textscan(fid‘%s%f%f%s%f%s%f%f%f%f%s%f%s%*[^\n]‘‘Delimiter‘‘‘);
????modeall?=?rawdata{7};
????idx?=?modeall?~=0;
????nsol?=?length(rawdata{4});
????
????%?默認(rèn)為北半球
????latsig?=?ones(nsol1);
????for?i=?1:nsol
????????if?cell2mat(strfind(rawdata{14}(i)‘S‘))
????????????latsig(i)?=?-1;
????????end?
????end?
????%?默認(rèn)為東半球
????nsol?=?length(rawdata{6});
????lonsig?=?ones(nsol1);
????for?i=?1:nsol
????????if?cell2mat(strfind(rawdata{16}(i)‘W‘))
????????????lonsig(i)?=?-1;
????????end?
????end?????
????TT?=?cell2mat(rawdata(2));
????hour?=?floor(TT/10000);
????minute?=?floor((TT-hour*10000)/100);
評(píng)論
共有 條評(píng)論