so I have a txt file containing data like this
1st row 1 2 3 2nd row 4 5 6 3rd row 7 8 9
I want to load the data in a loop it will read the values in the row eg. a=1 b=2 c=3
and subsequently load the 2nd row and the 3rd row.
how do I do this?

 Akzeptierte Antwort

Jan
Jan am 24 Mär. 2011

2 Stimmen

FID = fopen(FileName, 'r');
while ~feof(FID)
Line = fgetl(FID);
if ischar(Line)
D = sscanf(Line, '%g');
a = D(1);
b = D(2);
c = D(3);
... % The calulations here
end
end

Weitere Antworten (0)

Kategorien

Mehr zu Data Import and Analysis finden Sie in Hilfe-Center und File Exchange

Produkte

Tags

Gefragt:

Hoa
am 24 Mär. 2011

Community Treasure Hunt

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

Start Hunting!

Translated by