MATLAB: Hi. There a text file with many lines and the professor asked me to extract from this text file in a matrix just the lines which contains the word GPS10.he suggested me use fgetl and while lope. Could you please help me

fgetltext file

filename=uigetfile;
fid=fopen('sp3data.txt');

Best Answer

fid = fopen('sp3data.txt');
tline = fgetl(fid);
while ischar(tline)
disp(tline)
tline = fgetl(fid)
end
fclose(fid);
Read about contains , strcmp, strfind etc..to check whether your desired string is present in the line...and save them .