Macro loop problem

I was thinking about including one file in the mod-file and then wrapping it with something like:

equations={'k=0.9*k(-1)+invest;'
'k=0.8*k(-1)+invest;'};

for ii=1:size(equations,1)
%write equation to file
fid=fopen('my_equation.mod','w');
fprintf(fid,'%s \n',equations{ii,1});
fclose(fid);
%run file
dynare my_modfile noclearall
%save results
save('results_',num2str(ii)])
end
2 Likes