• 大小: 4KB
    文件类型: .m
    金币: 1
    下载: 0 次
    发布日期: 2021-06-09
  • 语言: Matlab
  • 标签: matlab  gps  

资源简介

本程序为读取Rinex格式的O文件,只要是标准的Rinex格式都能够成功读取,不留死角

资源截图

代码片段和文件信息

function ReadObs

% Read Observation Data

global ObsData
global ObsHead

[filenameObspathnameObs]=uigetfile(‘*.*o‘‘当天的o文件‘);
fidObs=fopen(strcat(pathnameObsfilenameObs)‘rt‘);
if fidObs==-1
    warndlg(‘o文件路径不对!请检查。‘‘Warning‘);
    return;
end
tic
while feof(fidObs)==0   %read head of the file
    line=fgetl(fidObs);
    comment=line(61:end);
    if ~isempty(strfind(comment‘# / TYPES OF OBSERV‘))
        ObsHead.Types=str2double(line(5:6));
        if ObsHead.Types>9
            line2=fgets(fidObs);
            line=[line(1:60)line2(7:60)];
        end
        ObsHead.Type=zeros(1ObsHead.Types);
        for i=1:ObsHead.Types
            temp=line(5+6*i:6+6*i);
            if strcmp(temp‘C1‘)==1
                ObsHead.Type(i)=1;
            elseif strcmp(temp‘P1‘)==1
                ObsHead.Type(i)=2;
            elseif strcmp(temp‘P2‘)==1
                ObsHead.Type(i)=3;
            elseif strcmp(temp‘L1‘)==1
                ObsHead.Type(i)=4;
            elseif strcmp(temp‘L2‘)==1
                ObsHead.Type(i)=5;
            elseif strcmp(temp‘D1‘)==1
                ObsHead.Type(i)=6;
            elseif strcmp(temp‘D2‘)==1
                ObsHead.Type(i)=7;
            end
        end
    elseif  ~isempty(strfind(comment‘APPROX POSITION XYZ‘))
        ObsHead.AppCoor=[str2double(line(1:14)) str2double(line(15:28)) str2double(line(29:42))];
    elseif ~isempty(strfind(comment‘ANTENNA: DELTA H/E/N‘))
        ObsHead.AntHEN=[str2double(line(1:14)) str2double(line(15:28)) str2double(line(29:42))];
    elseif ~isempty(strfind(comment‘MARKER NAME‘))
        ObsHead.MarkerName=line(1:4);
    elseif ~isempty(strfind(comment‘TIME OF FIRST OBS‘))
        ObsHead.First_Obs=[str2double(line(5:6)) str2double(line(11:12)) str2double(line(17:18))];
        ObsHead.DOY=UTC2MJD(str2double(line(5:6))str2double(line(11:12))str2double(line(17:18))000) ...
                    -UTC2MJD(str2double(line(5:6))11000)+1;       
    elseif ~isempty(strfind(comment‘END OF HEADER‘))
        break;        
    end
end

epo=0;
while feof(fidObs)==0   %read data of the file
    line=fgets(fidObs);
    if isempty(deblan

评论

共有 条评论