Header and repeating time information removal from a GPS TEC rinex file

1.1k Views Asked by At

I have a rinex file and is shown here..an image showing the first part of rinex file

http://imageshack.us/photo/my-images/593/65961409.jpg

The data (AOPR Rinex file) is downloaded from the site after entering a year and a day.

http://www.naic.edu/aisr/GPSTEC/gpstec.html

I want to open this file as a matrix in matlab for further processing..After the end of header at the 42nd line the time information is on 43 rd line. Then data starts. But time information is coming again after some rows say 64 the line, which should be discarded. Header should also be discarded. Also the last column is coming below the first column as a second row which should be transferred to the last column. Totally there are 55700 rows. Kindly help me with this.

2

There are 2 best solutions below

0
On

I suspect the last column appearing on the line below it is just an artifact of how large the window of your text reader is...

For the rest, I think a trial-and-error loop is in place here:

fid = fopen('test.txt','r');
C = {};
while ~feof(fid)
    % read lines with dictated format.
    D = textscan(fid, '%d %d %d %d');

    % this will fail on headerlines, empty lines, etc.
    if isempty(D{1})
        % in those cases, advance the file pointer by one line
        fgetl(fid);
    else
        % if that's not the case, save the lines thus read 
        C = [C;D]; %#ok
    end
end
fclose(fid);

% Post-process: concatenate all sub-arrays into one
C = arrayfun(@(ii) cat(1, C{:,ii}), 1:size(C,2), 'UniformOutput', false);

This works, at least with my test.txt:

header 
random 
garbage
1 2 3 4
4 5 6 7
4 6 7 8
more random garbage
2 5 6 7
5 6 7 8
8 6 3 7
0
On

I suspect the last column appearing on the line below it is just an artifact of how large >the window of your text reader is...

For the rest, I think a trial-and-error loop is in place here

Dear Rody I don't have any matlab background and just a beginner. It is actually a Rinex file..with 2780 epochs and 6 observables with 30 satellite values..Decoding it in matlab is tough. That is the problem. You can read a sample code at

http://web.ics.purdue.edu/~tdauterm/EAS591/Lab7/read_rinexo.m

But the problem is that the observables are six and there only 5 in the m-file which also is not in the correct order. I need C1 P2 L1 L2 S1 S2...but the code at the link gives L1 L2 C1 P1 P2. :( Can you just correct that..Then it will be a great help..