I am creating a loop to read a rather large multi column txt file and change the 2 digit date to 4 digit and my scan function is returning an error in line 6 the first line fscanf is used I am sure its in my syntax used there. Any help is much appreciated!!!
fid=fopen('test.txt', 'r') while ~feof(fid) tline=fgetl(fid); Year=fscanf(fid,'%g',[1 1:2:inf]); Month=fscanf(fid,'%g',[1 2:2:inf]); Lowtemp=fscanf(fid,'%g',[1 2:2:inf]); Hightemp=fscanf(fid,'%g',[1 2:2:inf]); Precip=fscanf(fid,'%g',[1 2:2:inf]); Year=Year + 1900end fileID = fopen('newtxt.txt','w');fprintf(fileID, 'Year Month LowTemp HighTemp Precip\n');fprintf(fileID,'%g %g %g %g %g\n',Year,Month,Lowtemp,Hightemp,Precip);fclose(fileID);
_____________
>> temphwfid = 9Maximum variable size allowed by the program is exceeded.Error in temphw (line 6) Year=scanf(fid,'%g',[1 1:2:inf]);
Best Answer