How to use only GPGGA strings from a .csv file?

3 views (last 30 days)
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:)

Answers (1)

Shiva Kalyan Diwakaruni
Shiva Kalyan Diwakaruni on 14 Dec 2020
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.

Categories

Find more on Data Type Identification in Help Center and File Exchange

Tags

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!