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

2 次查看(过去 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:)

回答(1 个)

Shiva Kalyan Diwakaruni
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.

类别

Help CenterFile Exchange 中查找有关 Data Type Identification 的更多信息

标签

Community Treasure Hunt

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

Start Hunting!

Translated by