Effacer les filtres
Effacer les filtres

How to process text file line by line

3 vues (au cours des 30 derniers jours)
Fateme Jalali
Fateme Jalali le 24 Déc 2015
Modifié(e) : dpb le 25 Déc 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.

Réponses (1)

dpb
dpb le 24 Déc 2015
Modifié(e) : dpb le 25 Déc 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);
>>

Catégories

En savoir plus sur Migrate GUIDE Apps dans Help Center et File Exchange

Community Treasure Hunt

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

Start Hunting!

Translated by