reading data with loop
10 views (last 30 days)
Hey, I would like to read columns from datafiles (named 1.TXT to 129.TXT) with the 'textread' command. I tried this:
filename = sprintf('%0d.TXT',i)
[a,b,c,d] = textread(filename,'%f%f%f%f')
... which does not work. Does anyone know, how I should write this loop?
TastyPastry on 27 May 2016
Edited: TastyPastry on 27 May 2016
Your for loop declaration is wrong. Needs to be:
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.