Hi
I need to create a run file, I have several lines of code that I need a run file execute over a number of (.dat) files.
a simple, one run looks like this
reset;
option solver cplex;
model ABC.mod;
data a_1.dat;
solve;
What I need is to repeat that same commands with only 1 modification. each new time using a new (.dat) file.. I have the dat files numbered (i.e. a_1.dat, a_2.dat ,...., a_1000.dat)
I wrote the following code, however, I keep getting 1 file with 1 set of commands.
clear all;
TNOR=6;
for i = 1:TNOR
L1 = 'reset;';
L2 = 'option solver cplex';
L3 = 'model ABC.mod;';
s1 = 'data a_' ;
s2 = (num2str('%d', i)) ;
s3 = '.dat ;';
L4=strcat(s1,s2,s3);
L5= 'solve;';
FID=fopen('runfile.run','w');
fprintf(FID,'%s \n',L1, L2, L3);
fprintf(FID,'%s \n',L4);
fprintf(FID,'%s \n',L5);
fprintf(FID,'\n');
fprintf(FID,'\n');
end
fclose all;