• 大小: 14KB
    文件类型: .m
    金币: 1
    下载: 0 次
    发布日期: 2021-06-15
  • 语言: Matlab
  • 标签: GPS  RINEX  读取  

资源简介

GPS RINEX格式读取MATLAB版。 适用于标准rinex格式的O文件,代码简洁易懂,读取数据效率高。

资源截图

代码片段和文件信息

%========================================
%     Cycle-slip
%     Zhen Dai
%========================================
% Functions:
%      Read  the RINEX observation file and save the measurement
% Input parameters:
%      filename --> RINEX observation file name
%      sampling_interval --> Sampling interval in Seconds (0.1 s == 10 Hz ......)
%      totalepoch -> total epochs to be processed. -999 implies processing
%               all the data in this file
% Output:
%      mSatID -> Satellite visibility of each epoch
%      vTime-> Time of each epoch scaled to “second of week“
%      vTimeStr -> Time expressed in STRING
%      interval -> Sampling interval of the data
%      mCode -> C/A code on  L1 signal
%      mPhase -> Carrier phase data on L1 signal
%  Remarks:
%      1. Only read the data from the GPS satellites
%      2. Only consider the L1 C/A and L1 phase data
%      3. Outputs are saved in a data file
%      4. It may provide some unexpected result when processing some
%      specially formatted RINEX observation file.

function [datafilenametotalepoch_real]=GUIMain_LoadRinexOBS(filenamesampling_intervaltotalepoch)
% function [datafilenametotalepoch_real]=GUIMain_LoadRinexOBS()
%% GUI Initialization
f1=figure;
close(f1);
figure;
title=sprintf(‘Reading RINEX observation file‘);
set(gcf‘MenuBar‘‘none‘‘Numbertitle‘‘off‘‘Name‘title...
    ‘Position‘[400 500 450 150]‘Visible‘‘off‘);
movegui(gcf‘center‘);
hlistbox = uicontrol(gcf‘style‘ ‘listbox‘ ‘String‘ ‘Clear‘...
    ‘Position‘ [0 0 450 150]‘String‘‘‘‘Foregroundcolor‘‘k‘‘Backgroundcolor‘‘w‘);
set(gcf‘Visible‘‘on‘);

datafilename=sprintf(‘RawDataTemp‘);
 

%% Start reading the RINEX file
totalGNSSsatellite=32;
vSatID=zeros(totalGNSSsatellite1);
interval=0;
%% Initialize the data matrix.
if totalepoch==-999 %% When the total number of epochs are unknown
    vTime=[];  mCode=[]; mPhase=[]; vTimeStr=[];mDoppler1=[];mDoppler2=[];
elseif   totalepoch>0%% With the known number of epochs
    vTime=zeros(totalepoch1);
    vTimeStr=cell(totalepoch1);
    mP1=zeros(totalGNSSsatellitetotalepoch);
    mC1=zeros(totalGNSSsatellitetotalepoch);
    mL1=zeros(totalGNSSsatellitetotalepoch);
    mP2=zeros(totalGNSSsatellitetotalepoch);
    mL2=zeros(totalGNSSsatellitetotalepoch);
    mD1=zeros(totalGNSSsatellitetotalepoch);
    mD2=zeros(totalGNSSsatellitetotalepoch);
else
    errordlg(‘Invalid total number of epochs‘)
end

%% Open the file
fid = fopen(filename);
if fid==-1
    errmsg=sprintf(‘Can not open this file%s‘filename);
    errordlg(errmsg);
    return;
end

line80num=0;

obsC1pos=0; %% Indicates which observation is C/A code
obsL1pos=0; %% Indicates which observation is phase on L1
obsP1pos=0; %% Indicates which observation is P1 code
obsL2pos=0; %% Indicates which observation is phase on L2
obsP2pos=0; %% Indicates which observation is P2 code
obsD1pos=0; %% Indicates which obs

评论

共有 条评论