How to extract only '$GPGGA' string real-time from Garmin gps device on matlab ?
3 views (last 30 days)
Show older comments
Hello, I am trying to extract GPS signals real-time from a Garmin 18x device by using serial communication. But every time I run the program using a 'while' loop, there are other strings namely '$GPVTG' and '$PGRME' also being read. I just need '$GPGGA' string for my use case which I'm not able to extract.
I did try using 'textscan' and 'strtok' but nothing worked as there are 3 different string types and lengths. The command window showing the string data being read is as shown in the image.
The code I used is below:
% Extraction of data from GPS
garmin_gps = serial('COM4','Baudrate', 19200); %Create serial port object 'garmin_gps' to connect Garmin device
set(garmin_gps, 'InputBufferSize', 512000);
set(garmin_gps, 'terminator', '*')
fopen(garmin_gps);
Z = isempty('InputBufferSize')
while Z == 0
D = fscanf(garmin_gps, '%s')
end

0 Comments
Answers (1)
See Also
Categories
Find more on String Parsing in Help Center and File Exchange
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!