Hey, I would like to read columns from datafiles (named 1.TXT to 129.TXT) with the 'textread' command. I tried this:
for i=1,129
filename = sprintf('%0d.TXT',i)
[a,b,c,d] = textread(filename,'%f%f%f%f')
end
... which does not work. Does anyone know, how I should write this loop?

답변 (1개)

TastyPastry
TastyPastry 2016년 5월 27일
편집: TastyPastry 2016년 5월 27일

0 개 추천

Your for loop declaration is wrong. Needs to be:
i=1:129
Try using textscan(), which can take in a file and a format and outputs a cell array. More here. textscan() offers several advantages over textread(), one of which is that it dumps data into a cell array rather than a bunch of variables.

카테고리

도움말 센터File Exchange에서 Loops and Conditional Statements에 대해 자세히 알아보기

태그

질문:

2016년 5월 27일

편집:

2016년 5월 27일

Community Treasure Hunt

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

Start Hunting!

Translated by