I have .txt files that contain the output from a data logger. The data is logged in a very specific way, with one message per line, and with a message ID in front of each message. So, by knowing the message ID of each line, I will know what will follow on that line due to the message format. Each message (different ID) has a different format. An example of the data:
$GPGGA,220542.000,4745.8026,N,12211.0284,W,1,07,1.3,3.4,M,-17.2,M,,0000*67
$GPGSA,A,3,30,05,29,31,02,10,25,,,,,,2.0,1.3,1.5*3D
$GPGSV,3,1,12,29,78,315,39,05,52,080,45,30,43,288,46,25,41,196,33*72
$GPGSV,3,2,12,21,31,249,30,02,23,066,41,12,17,172,38,31,11,276,40*7F
$GPGSV,3,3,12,10,07,036,30,26,02,115,,18,01,199,,48,34,194,37*73
$GPRMC,220542.000,A,4745.8026,N,12211.0284,W,0.08,174.78,271011,,*12
$GPGGA,220543.000,4745.8025,N,12211.0284,W,1,07,1.3,3.4,M,-17.2,M,,0000*65
Everything is separated by commas, but since each line is different (ie each message does not have the same format), I can't do anything with csv (in Matlab).
Basically, what I want to do is search through the data, line by line. For each line, I want to determine the message ID, then store the remainder of the line in an array, since I will know the format of the line. In the end, I will have an array for each message type.
I can put everything into excel using csv, but since each line is different it is hard to extract the data...and I don't even know if that is possible in excel (it probably is).
In Matlab, I can't use anything csv because there are non-numerical values. I have tried reading the file directly and grabbing each line using fgetl(), then stepping through each line, but there has to be a more efficient way. I read something about saving an excel file, then going to matlab to extract the data, but it would be nice to eliminate that intermediate step.
Ideas about how to go about this would be nice. I'm not looking for anyone to write code for me...just to point me in the write direction.
Oh, and I thought importdata() would work, but I tried importdata('filename.txt',','), but it would not recognize the delimiter...?