How can I make a for loop to read multiple txt files?

First of all, thank you so much. So, the problem is: I have a function that Matlab has created by using the Import Data Tool. The function is called 'importkeff'. The problem is that I have a lot of txt files with the same structure and I haven´t been able to create a for loop to execute the function and save the values in different vectors. I have tried this but I know is wrong. The txt files are named like this: 0000.V5W19.T17, 0001.V5W19.T17, 0002... and so until 0069.

for i=01:69
00ikeff19 = importkeff('00i.V5W19.T17')
end

Any ideas on how can I create a for loop to do it? Thanks

Upvotes: 1

Views: 54

Answers (1)

Burak
Burak

Reputation: 2495

keff = cell(69, 1);
for i=1:69
  keff{i} = importkeff(sprintf("%04d", i) + ".V5W19.T17");
end

Upvotes: 1

Related Questions