How to process text file line by line

1 Ansicht (letzte 30 Tage)
Fateme Jalali
Fateme Jalali am 24 Dez. 2015
Bearbeitet: dpb am 25 Dez. 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.

Antworten (1)

dpb
dpb am 24 Dez. 2015
Bearbeitet: dpb am 25 Dez. 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);
>>

Kategorien

Mehr zu Text Data Preparation finden Sie in Help Center und File Exchange

Community Treasure Hunt

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

Start Hunting!

Translated by