I have a text file with the following contents:
MSNout_BER (0:31) Observation #100 Rx'd at: (58568.000) Msg. Time: (58568.000) Forward to IMU: true Rcv Date: 2010121 Synch: f0f0 Rel Mode: ActiveMSNout_SSS (0:32) Observation #101 Rx'd at: (58569.000) Msg. Time: (58569.000) Forward to IRU: true Rcv Date: 2010121 Synch: a0a0 Bel Mode: HighType: 12 Malck ID: 12345 Time Tag: 58548.12345678Hand ID: 0 SV ID: 51 Spam ID: 0 BOZ/FAS: 0 Realt Flag: 0MSNout_BER (0:33) Observation #102 Rx'd at: (58570.000) Msg. Time: (58570.000) Forward to IMU: true Rcv Date: 2010121 Synch: f0f0 Rel Mode: ActiveMSNout_SSS (0:34) Observation #103 Rx'd at: (58571.000) Msg. Time: (58571.000) Forward to IRU: true Rcv Date: 2010121 Synch: a0a0 Bel Mode: HighType: 1 Malck ID: 12345 Time Tag: 58549.12345678Hand ID: 1 SV ID: 2 Spam ID: 0 BOZ/FAS: 1 Realt Flag: 0Type: 1 Malck ID: 12345 Time Tag: 58550.12345678Hand ID: 1 SV ID: 2 Spam ID: 0 BOZ/FAS: 1 Realt Flag: 0Type: 1 Malck ID: 12345 Time Tag: 58551.12345678Hand ID: 1 SV ID: 2 Spam ID: 0 BOZ/FAS: 1 Realt Flag: 0Type: 1 Malck ID: 12345 Time Tag: 58552.12345678Hand ID: 1 SV ID: 2 Spam ID: 0 BOZ/FAS: 1 Realt Flag: 0Type: 1 Malck ID: 12345 Time Tag: 58553.12345678Hand ID: 1 SV ID: 1 Spam ID: 0 BOZ/FAS: 1 Realt Flag: 0Type: 1 Malck ID: 12345 Time Tag: 58554.12345678Hand ID: 1 SV ID: 1 Spam ID: 0 BOZ/FAS: 1 Realt Flag: 0Type: 1 Malck ID: 12345 Time Tag: 58555.12345678Hand ID: 1 SV ID: 1 Spam ID: 0 BOZ/FAS: 1 Realt Flag: 0Type: 1 Malck ID: 12345 Time Tag: 58556.12345678Hand ID: 1 SV ID: 3 Spam ID: 0 BOZ/FAS: 1 Realt Flag: 0
I’m using the following commands to retrieve the values for the Time Tag: and SV ID: (values 1 and 2 only, all others are ignored);
[fn,pn] = uigetfile('*.txt,"Select Text File');OAMfilename = fullfile(pn, fn);buffer = fileread(OAMfilename);pattern = '*?Tag:\s+([\d\.]+).*?SV ID:\s+([12])\W';tokens = regexp(buffer, pattern, 'tokens');data = reshape(str2double([tokens{:}]), 2, []).';
Results:
58548.1234567800 258550.1234567800 258551.1234567800 258552.1234567800 258553.1234567800 158554.1234567800 158555.1234567800 1
Initially, I thought the results were as expected. Then I noticed the time tag for the first occurrence of SV ID equal to 2 was wrong – 58549.12345678 is the proper time tag.
Is it possible to force MATLAB to recognize each Time Tag value that occurs just prior to each SV ID value? Could a Lookaround operator be used in this case?
Best Answer