Reputation: 961
I am running a script that creates a matrix from a data file called epsi.resu, the file is then converted to a text file. I have multiple files epsi_value1_value2.resu where the number ranges from 20 to 58 for the first value and from 20 to 28 for the second value. I would like to do this process in a for loop. This is what I tried:
for i = 20:2:26
for j = 20:2:28
epsi = importfile1('epsi_i_j.resu', 6, 9);
writetable(epsi,'epsi_i_j.txt','Delimiter',' ');
type 'epsi.resu';
end
end
Unfortunately this produces an error "invalid file identifier"
Upvotes: 0
Views: 32
Reputation: 106
it is because 'epsi_i_j.resu' is a constant string
if i worth 0 and j 0 it still try to read 'epsi_i_j.resu' and not 'epsi_0_0.resu' i'm not sure of the syntaxe but try something like
epsi = importfile1( ['epsi_' num2str(i) '_' num2str(j) '.resu'],6,9)
Upvotes: 2