In: Computer Science
noLinesGPS = 8;
noLinesGLONASS = 4;
noLinesGALILEO = 8;
noLinesBEIDOU = 8;
n = 0;
while n == 0
txtLine = fgetl(fid_temp);
if (txtLine == -1)
break;
end
if (isempty(txtLine))== 1
break;
end
if (txtLine(1) == 'G')
dataGPS = txtLine;
for nLine = 1:noLinesGPS
txtLine = fgetl(fid_temp);
dataGPS = sprintf('%s %s', dataGPS, txtLine);
end
elseif (txtLine(1) == 'R')
dataGLONASS = txtLine;
for nLine = 1:noLinesGLONASS
txtLine = fgetl(fid_temp);
dataGLONASS = sprintf('%s %s', dataGLONASS, txtLine);
end
elseif (txtLine(1) == 'E')
dataGALILEO{idxGALILEO} = txtLine;
for nLine = 1:noLinesGALILEO
txtLine = fgetl(fid_temp);
dataGALILEO = sprintf('%s %s', dataGALILEO, txtLine);
end
%idxGALILEO = idxGALILEO + 1;
elseif (txtLine(1) == 'C')
dataBEIDOU = txtLine;
for nLine = 1:noLinesBEIDOU
txtLine = fgetl(fid_temp);
dataBEIDOU = sprintf('%s %s', dataBEIDOU, txtLine);
end
end
n = 1;
end
See the loop copiedied in above. I have a series of loops starting at line 112. Only the first loop is processing. I know this because when I debug the code only dataGPS shows up in my workspace. I need the program to read a RINEX file and sort it by GPS constellation so after GPS I need the program to check for GLONASS, Galileo and Beidou constellations. Right now the loop to check for gps is the only one processing. Could you please show me the proper syntax to allow each loop to run?
noLinesGPS = 8;
noLinesGLONASS = 4;
noLinesGALILEO = 8;
noLinesBEIDOU = 8;
% infinite loop that continues, till the end of file is reached
or an empty line is encountered in the file
while 1
txtLine = fgetl(fid_temp); % read a line from
file
% end of file is reached, exit the loop
if (txtLine == -1)
break;
end
% empty line, exit the loop
if ((isempty(txtLine))== 1)
break;
end
if (txtLine(1) == 'G')
dataGPS = txtLine;
for nLine = 1:noLinesGPS
txtLine =
fgetl(fid_temp);
dataGPS =
sprintf('%s %s', dataGPS, txtLine);
end
elseif (txtLine(1) == 'R')
dataGLONASS = txtLine;
for nLine = 1:noLinesGLONASS
txtLine =
fgetl(fid_temp);
dataGLONASS =
sprintf('%s %s', dataGLONASS, txtLine);
end
elseif (txtLine(1) == 'E')
dataGALILEO{idxGALILEO} =
txtLine;
for nLine = 1:noLinesGALILEO
txtLine =
fgetl(fid_temp);
dataGALILEO =
sprintf('%s %s', dataGALILEO, txtLine);
end
%idxGALILEO = idxGALILEO + 1;
elseif (txtLine(1) == 'C')
dataBEIDOU = txtLine;
for nLine = 1:noLinesBEIDOU
txtLine =
fgetl(fid_temp);
dataBEIDOU =
sprintf('%s %s', dataBEIDOU, txtLine);
end
end
end