Hi. There a text file with many lines and my 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?

4 visualizaciones (últimos 30 días)
filename=uigetfile;
fid=fopen('sp3data.txt');

Respuesta aceptada

KSSV
KSSV el 30 de Nov. de 2017
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 .
  1 comentario
gblmtc
gblmtc el 30 de Nov. de 2017
Editada: Stephen23 el 30 de Nov. de 2017
Thanks KSSV! I used the code , it works but what I need are just the lines with the word PG10. Please have a look on the file.

Iniciar sesión para comentar.

Más respuestas (0)

Categorías

Más información sobre Large Files and Big Data en Help Center y File Exchange.

Etiquetas

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!

Translated by