I am getting Undefined function or variable 'A', error in Untitled line 95
Show older comments
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 Comments
KSSV
on 13 Sep 2021
We cannot help unless the input file is given. The error is clear, it says the variable A is not defined and you are trying to use it.
Dahati rafihna
on 13 Sep 2021
Jan
on 13 Sep 2021
Please post the complete error message. Do no let the readers count, which the "line 95" is.
Accepted Answer
More Answers (0)
Categories
Find more on Measurements and Spatial Audio in Help Center and File Exchange
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!