function [bclk] = READnav_clock(Filename) % % Function reads specified navigation file and returns the % clock paramiters for all sats. % [ bclk ] = READnav_clock(Filename) % inputs: Filename to read i.e. 'auto0010.01n' % % Outputs: bclk rows by PRN # % Columns: % 1: Time of ephemeris, in GPS sec of week % 2: Clock bias (sec) % 3: Clock drift (sec/sec) % 4: Clock drift rate (sec/sec2) % so if you want the clock values for PRN 3 % % toe = bclk(3, 1) % bias = blck(3,2) % drift = blck(3,3) % drift_rate = blck(3,4) % % David Benson % 7/3/01 fid5 = fopen(Filename); %load navigation file % check for valid fid if fid5 == -1 bclk = 0; disp([' Error, READnav_clock: can not open file']) return end info = fgets(fid5,60); header = fgets(fid5); while strncmp(header,'END OF HEADER',13) == 0; % find end of header info = fgets(fid5,60); header = fgets(fid5); end bclk = zeros(40,4); check = zeros(40,1); while 1 % get data set time_line = fgets(fid5); line1 = fgets(fid5); line2 = fgets(fid5); line3 = fgets(fid5); line4 = fgets(fid5); line5 = fgets(fid5); line6 = fgets(fid5); line7 = fgets(fid5); % check for end of file if eval('time_line') == -1 break end Prn = str2num(time_line(1:2)); if check(Prn) == 0 check(Prn) = 1; CLK_bias = str2num(time_line(23:37)) * 10^(str2num(time_line(39:41))); CLK_drift = str2num(time_line(42:56)) * 10^(str2num(time_line(58:60))); CLK_drift_rate = str2num(time_line(61:75)) * 10^(str2num(time_line(77:80))); Toe = str2num(line3(4:18)) * 10^(str2num(line3(20:22))); % save data in matrix bclk(Prn,:) = [Toe, CLK_bias, CLK_drift, CLK_drift_rate]; end end