How to process text file line by line

1 visualización (últimos 30 días)
Fateme Jalali
Fateme Jalali el 24 de Dic. de 2015
Editada: dpb el 25 de Dic. de 2015
Hi,I have a text file dataset.my data in the text file is like this:
220 210
1678
380 568 90
i want to process each line of data separately.i need the code to read each line.

Respuestas (1)

dpb
dpb el 24 de Dic. de 2015
Editada: dpb el 25 de Dic. de 2015
doc fgetl
>> fid=fopen('fatem.dat');
>> while ~feof(fid)
x=sscanf(fgetl(fid),'%f');
% insert desired processing here; just display the data here for example
disp(x.')
end
220 210
1678
380 568 90
>> fid=fclose(fid);
>>

Categorías

Más información sobre Text Data Preparation 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