How to process text file line by line

1 visualizzazione (ultimi 30 giorni)
Fateme Jalali
Fateme Jalali il 24 Dic 2015
Modificato: dpb il 25 Dic 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.

Risposte (1)

dpb
dpb il 24 Dic 2015
Modificato: dpb il 25 Dic 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);
>>

Categorie

Scopri di più su Text Data Preparation in Help Center e File Exchange

Community Treasure Hunt

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

Start Hunting!

Translated by