function [gpseph,galeph,bdseph,gloeph] = readeph(file_name)
...
eof_flag = 0;
eph_count = 1;
[data, num_read] = fscanf(fid,'%c');
c = fprintf(fid_temp,'%c',data);
fid_temp = fopen('temp.dat','r');
nLine = zeros(1,4);
noLinesGPS = 8;
noLinesGLONASS = 4;
noLinesGALILEO = 8;
noLinesBEIDOU = 8;
idxGPS = 1;
idxGLONASS = 1;
idxGALILEO = 1;
idxBEIDOU = 1;
while ~feof(fid)
txtLine = fgetl(fid_temp);
if (txtLine == -1)|isempty(txtLine), break; end
switch txtLine(1)
case 'G'
dataGPS{idxGPS} = txtLine;
for nLine = 1:noLinesGPS
txtLine = fgetl(fid_temp);
dataGPS{idxGPS} = sprintf('%s %s', dataGPS{idxGPS}, txtLine);
end
idxGPS = idxGPS + 1;
case 'R'
dataGLONASS{idxGLONASS} = txtLine;
for nLine = 1:noLinesGLONASS
txtLine = fgetl(fid_temp);
dataGLONASS{idxGLONASS} = sprintf('%s %s', dataGLONASS{idxGLONASS}, txtLine);
end
idxGLONASS = idxGLONASS + 1;
case 'E'
dataGALILEO{idxGALILEO} = txtLine;
for nLine = 1:noLinesGALILEO
txtLine = fgetl(fid_temp);
dataGALILEO{idxGALILEO} = sprintf('%s %s', dataGALILEO{idxGALILEO}, txtLine);
end
idxGALILEO = idxGALILEO + 1;
case 'C'
dataBEIDOU{idxBEIDOU} = txtLine;
for nLine = 1:noLinesBEIDOU
txtLine = fgetl(fid_temp);
dataBEIDOU{idxBEIDOU} = sprintf('%s %s', dataBEIDOU{idxBEIDOU}, txtLine);
end
idxBEIDOU = idxBEIDOU + 1;
end
end
end
...
Best Answer