I am getting Undefined function or variable 'A', error in Untitled line 95
1 Ansicht (letzte 30 Tage)
Ältere Kommentare anzeigen
fileid = fopen('RINEX.txt');
while ~feof(fileid)
y = fgetl(fileid);
a = strfind(y,'END OF HEADER');
if a>0
break;
end
end
% -------------------------------------------------------------------------
% -------------------------------------------------------------------------
% Reading the Data Section
% -------------------------------------------------------------------------
% -------------------------------------------------------------------------
f1 = (1575.42*1e6);
f2 = (1227.60*1e6);
m = 0;
r = 0;
while ~feof(fileid)
try
y = fgetl(fileid);
disp(y);
if size(y,2)<35
disp('continuing')
continue
end
y1 = y(1,01:30);
numsat = str2num(y(:,31:32)); % Read the numbers of satellite
% ------------------------------------------------
timehr = str2num(y1(:,11:12)); % Read the hour
timemin = str2num(y1(:,14:15)); % Read the minute
timesec = str2num(y1(:,17:26)); % Read the second
if timemin==0
clc
disp('Processing data for the hour');
disp(timehr);
disp(timemin);
disp(timesec);
end
% --------------------------------------------------
y2 = y(1,33:end);
ys = y2;
if (numsat>12 && numsat<24)
y3 = fgetl(fileid);
ys = [ys y3];
end
if (numsat>24)
y4 = fgetl(fileid);
ys = [ys y4];
end
satnum = []; % Refresh this variable for every new read
c = 1;
for tt=1:size(ys,2)
if ( ys(tt)=='E' || ys(tt)=='G' || ys(tt)=='R')
ST(c) = ys(tt);
satnum(c) = str2num(ys(:,tt+1:tt+2)); % selecting the satellite numbers
tt = tt+2;
c = c+1;
end
end
% --------------------------------------------------
c = 0;
for j = 1:numsat
lin1 = fgetl(fileid);
lin2 = fgetl(fileid);
if (isempty(lin1) || isempty(lin2) || size(lin1,2)<63)
continue;
end
rangeL1 = str2num(lin1(:,35:46)); % read the range in L1
rangeL2 = str2num(lin1(:,51:63)); % read the range in L2
if (isempty(rangeL1) || isempty(rangeL2))
continue;
end
z = satnum(j); % find the satellite number of the current satellite
sod = timehr*3600 + timemin*60 + timesec; % get the current time in seconds of day
rr = round(sod/30)+1; % find the row number from the time
A(rr,:,z) = [sod,rangeL1,rangeL2]; % populate the corresponding page with the
current data
end
pause(1)
catch
disp('Error Encountered. Moving to next Data');
end
end
Den = ((1/f1.^2)-(1/f2.^2));
for jj = 1:size(A,3)
A(:,4,jj) = (A(:,2,jj)-A(:,3,jj))/40.3/Den/1e16;
end
3 Kommentare
Jan
am 13 Sep. 2021
Please post the complete error message. Do no let the readers count, which the "line 95" is.
Akzeptierte Antwort
Jan
am 13 Sep. 2021
The variable A should be polulated in this line:
A(rr,:,z) = [sod,rangeL1,rangeL2];
If A in undefined, this line was not called. Check this by setting a break point in this line and running the code again.
Select all code (ctrl a) and indent it properly (ctrl i). Then it is much easier to find out visually, which loop is not entered. Check this also using the debugger: Set a break point before the loops and step through the code line by line.
0 Kommentare
Weitere Antworten (0)
Siehe auch
Kategorien
Mehr zu String Parsing finden Sie in Help Center und File Exchange
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!