How to use only GPGGA strings from a .csv file?
조회 수: 6 (최근 30일)
이전 댓글 표시
Hi guys,
I feel a bit stupid because Im asking this eventough I solved it for strings already. I have a.csv file with NMEA data which is 5 row / sample. I only want to use the 'GPGGA' strings from them. This is what I did so far:
% Load all GPS data
[~, raw_gps] = xlsread('20201110_GPSall.csv');
if strfind('$GPGGA') == 1
gps_data = split(raw_gps,',');
end
and I get an error the 'Not enough input arguement'. I think it is because I use xlsread and strfind cant search in xls file. Can someone tell me which command I should use to find only the 'GPGGA' ones?
Thank you very much in advance for any help:)
댓글 수: 0
답변 (1개)
Shiva Kalyan Diwakaruni
2020년 12월 14일
Hi,
You can try using csvread or textscan
example -
1) data=csvread('yourfile.csv');
if strfind('$GPGGA') == 1
gps_data = split(raw_gps,',');
end
2) fields=textscan(FileId,'%s','delimiter',',')
if ~isempty(find(strcmp(fields{1}(1), '$GPGGA'),1))
gps_data = split(raw_gps,',');
end
Hope it helps.
댓글 수: 0
참고 항목
카테고리
Help Center 및 File Exchange에서 String Parsing에 대해 자세히 알아보기
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!