I am working on a MATLAB App which takes serial data from a GPS receiver and plots it in real time. The only part of this which I am having trouble with is actually filtering this serial data and reliably extracting the data I need from it. The data is (to my knowledge) not formatted in any standard format so I haven't been able to find any kind of process which I can follow to filter out the garbage data.
This is how the data looks in PuTTY:

and this is how the data looks in MATLAB (when displayed line-by-line):

What I need from this data is the "lt" and "ln" values from the lines which start with @ GPS_STAT.
@ GPS_STAT 202 0000 00 00 00:01:29.038 CRC_OK TRK FthrWt04326 Alt 000000 **lt +00.00000 ln +00.00000** Vel +0000 +000 +0000 Fix 0 # 0 0 0 0 000_00_00 000_00_00 000_00_00 000_00_00 000_00_00 CRC: 7FE9
The constraints of the project this is a part of require that I use MATLAB but if anyone has a solution in Python I'm sure I can figure out how to translate the process into ML.
I've tried various ways of reading serial data line by line and using string parsing and indexing to get the data I want but I still run in to issues because there are occasional extra new lines or other strange characters that MATLAB doesn't like.
Any help is appreciated!
Use regular expressions to parse latitudes & longitudes from your data. This documentation will help you.
Step 1: Read the File
Step 2: Match Lines with @ GPS_STAT using regexp
Step 3: Extract Latitude and Longitude using regexp from the matched line
In Python, you'd follow a similar approach using the re module for regular expressions.