clear all
format compact 
format short

counter = 0;

for i = 94:107
    for j = 1:4
       
       cl = clock;
       display(['day ', num2str(cl(3)), ' hour ', num2str(cl(4)), ' minute ', num2str(cl(5))])
       display(['file: data',num2str(i),'q',num2str(j)])
       
        
       datafile_string=['data',num2str(i),'q',num2str(j),'.mat'];
       nobs = 119 + 4*(i-94) + (j-1);
       eval(['dynare sw2007nw_dsge -Ddatafile_name="',datafile_string,'" -Dnobs_counter=' num2str(nobs)])
       
       copyfile('sw2007nw_dsge/metropolis/sw2007nw_dsge_mh*',['dsge/',num2str(i),'q',num2str(j)]);
       global M_ dr1_test ex0_ it_ oo_recursive_  trend_coeff_ bayestopt_  estim_params_  fjac  oo_ options_ ys0_  
       save(['dsge/',num2str(i),'q',num2str(j),'/results.mat']);   
       
       rmdir('sw2007nw_dsge','s')
       % rmdir('dynareParallelLogFiles','s')
       close all
       
       counter = counter + 1;    
       
    end
end