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

1 visualización (últimos 30 días)
Balint Egri
Balint Egri el 9 de Dic. de 2020
Respondida: Shiva Kalyan Diwakaruni el 14 de Dic. de 2020
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:)

Respuestas (1)

Shiva Kalyan Diwakaruni
Shiva Kalyan Diwakaruni el 14 de Dic. de 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.

Categorías

Más información sobre String Parsing en Help Center y File Exchange.

Etiquetas

Community Treasure Hunt

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

Start Hunting!

Translated by