Question

In: Computer Science

noLinesGPS = 8; noLinesGLONASS = 4; noLinesGALILEO = 8; noLinesBEIDOU = 8; n = 0; while...

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?

Solutions

Expert Solution

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  


Related Solutions

int f2 (int n) j = 0; while (j <n) {for (int i = 0; i...
int f2 (int n) j = 0; while (j <n) {for (int i = 0; i <n; ++ i) {cout << "j =" + j; j = j + 5; }}
Suppose we have N = 6 values from a population. These values are 4, 8, 0,...
Suppose we have N = 6 values from a population. These values are 4, 8, 0, 10, 14 and 6. Let μ and σ denote the population mean and population standard deviation of these six values, respectively. (a) What are the values of μ and σ, respectively? μ = 4.8580; σ = 7 μ = 7; σ = 4.8580 μ = 7; σ = 4.4347 μ = 7; σ = 19.6667 μ = 7; σ = 23.6 (b) What percentage...
A = (1 −7 5 0 0 10 8 2 2 4 10 3 −4 8...
A = (1 −7 5 0 0 10 8 2 2 4 10 3 −4 8 −9 6) (1) Count the number of rows that contain negative components. (2) Obtain the inverse of A and count the number of columns that contain even number of positive components. (3) Assign column names (a,b,c,d) to the columns of A. (4) Transform the matrix A into a vector object a by stacking rows. (5) Replace the diagonal components of A with (0,0,2,3). Hint:...
a = [3, -4, 7] b = [-6, 9, 8] c = [4, 0, 8] d...
a = [3, -4, 7] b = [-6, 9, 8] c = [4, 0, 8] d =[7, 1, 7] e = [3, -5, 2, 1] f =[5, -7, -3, 6] g = [3, -4, 4, 3] P = Projection of ex. C = |g|(gf/gf) C = gf/|f| ex. P g --> f = Cgf = C(gf/f) (1/|f|) (f) =( gf/ff)(f) Find a. Pg --> f b. Pa --> 3b + e Find (cross multiply) a. ||a X b|| b. ||g...
A= 1 2 4 0 1 -2 -1 0 1 2 0 3 8 1 4...
A= 1 2 4 0 1 -2 -1 0 1 2 0 3 8 1 4 . Let W denote the row space for A. (a) Find an orthonormal basis for W and for W⊥. (b) Compute projW⊥(1 1 1 1 1 ).
Gender Hair color male female total Blonde 0 4 4 Brunette 4 4 8 Red 0...
Gender Hair color male female total Blonde 0 4 4 Brunette 4 4 8 Red 0 1 1 Black 5 1 6 Other 2 1 3 total 11 11 22 Put formulas and answers in yellow shaded cells. Question 1 P(black hair) = 2 P(blonde hair) = 3 P(male AND brunette hair) = 4 P(red OR black) = 5 P(male OR brunette) = 1) The probability of having black hair. 2) The probability of having blonde hair. 3) The probability...
1- Three forces act on a point: 3 N at 0°, 4 N at 90°, and...
1- Three forces act on a point: 3 N at 0°, 4 N at 90°, and 5 N at 217°. a. What is the net force? b. What fourth force will put the point in equilibrium? 2- A 100 kg wooden crate rests on a wooden ramp with an adjustable angle of inclination. a. Draw a free body diagram of the crate. b. If the angle of the ramp is set to 10°, determine... i. the component of the crate's...
8. (a) Classify the quadric surface 4? 2 − ? + 2? 2 = 0. [4...
8. (a) Classify the quadric surface 4? 2 − ? + 2? 2 = 0. [4 points] (b) Find the traces of the above surface in xy, xz, yz-plane respectively. [6 points]
Consider the following. n = 8 measurements: 4, 3, 7, 8, 5, 6, 4, 6 Calculate...
Consider the following. n = 8 measurements: 4, 3, 7, 8, 5, 6, 4, 6 Calculate the sample variance, s2, using the definition formula. (Round your answer to four decimal places.) s2 = Calculate the sample variance, s2 using the computing formula. (Round your answer to four decimal places.) s2 = Find the sample standard deviation, s. (Round your answer to three decimal places.) s =
4. Given Pseudocode: Algorithm3(n): y = 0 for i = 1 to n do y =...
4. Given Pseudocode: Algorithm3(n): y = 0 for i = 1 to n do y = 1 while y < i2 do y=2y return y a. What's the output of Algorithm3(n) as a function of n? b. What's the running time of Algorithm3(n) as a function of n? Represent this as a summation. c. Prove the running time to be O(n log n).
ADVERTISEMENT
ADVERTISEMENT
ADVERTISEMENT