%clear all;
%mPars=readtable('~/Dropbox (SSSUP)/DSGEvsABM/rcode/dati/NK_baseline/New_sim/CoP_sob_Ind_Inf_1.csv');
mPars=readtable('~/Dropbox (SSSUP)/DSGEvsABM/rcode/dati/NK_baseline/New_sim/CoP_unif_Ind_Inf.csv');
bettas=table2array(mPars(:,2));
hs=table2array(mPars(:,3));
varpsis=table2array(mPars(:,4));
gammmas=table2array(mPars(:,5));
kappas=table2array(mPars(:,6));
alpphas=table2array(mPars(:,7));
thetaps=table2array(mPars(:,8));
chis=table2array(mPars(:,9));
thetaws=table2array(mPars(:,10));
chiws=table2array(mPars(:,11));
gammmaRs=table2array(mPars(:,12));
gammmays=table2array(mPars(:,13));
gammmaPIs=table2array(mPars(:,14));
PIbars=table2array(mPars(:,15));
rhods=table2array(mPars(:,16));
rhophis=table2array(mPars(:,17));
sigma_As=table2array(mPars(:,18));
sigma_ds=table2array(mPars(:,19));
sigma_phis=table2array(mPars(:,20));
sigma_mus=table2array(mPars(:,21));
sigma_ms=table2array(mPars(:,22));
Lambdamus=table2array(mPars(:,23));
LambdaAs=table2array(mPars(:,24));

%endo_exp = struct;

for i=1:length(bettas)
    betta=bettas(i);
    h=hs(i);
    varpsi=varpsis(i);
    gammma=gammmas(i);
    kappa=kappas(i);
    alppha=alpphas(i);
    thetap=thetaps(i);
    chi=chis(i);
    thetaw=thetaws(i);
    chiw=chiws(i);
    gammmaR=gammmaRs(i);
    gammmay=gammmays(i);
    gammmaPI=gammmaPIs(i);
    PIbar=PIbars(i);
    rhod=rhods(i);
    rhophi=rhophis(i);
    sigma_A=sigma_As(i);
    sigma_d=sigma_ds(i);
    sigma_phi=sigma_phis(i);
    sigma_mu=sigma_mus(i);
    sigma_m=sigma_ms(i);
    Lambdamu=Lambdamus(i);
    LambdaA=LambdaAs(i);
    dynare NK_baseline_II noclearall nolog;
    disp('CoP:');
    disp(i);
end

%Y_cop=Y_cop(:,:,1:150);
%P_cop=P_cop(:,:,1:150);
%R_cop=R_cop(:,:,1:150);
%mumu_z_cop=mumu_z_cop(:,:,1:150);

save '~/Dropbox (SSSUP)/DSGEvsABM/rcode/dati/NK_baseline/New_sim/data_laplace/Y_cop.mat';
save '~/Dropbox (SSSUP)/DSGEvsABM/rcode/dati/NK_baseline/New_sim/data_laplace/P_cop.mat';
save '~/Dropbox (SSSUP)/DSGEvsABM/rcode/dati/NK_baseline/New_sim/data_laplace/R_cop.mat';
save '~/Dropbox (SSSUP)/DSGEvsABM/rcode/dati/NK_baseline/New_sim/data_laplace/C_cop.mat';
save '~/Dropbox (SSSUP)/DSGEvsABM/rcode/dati/NK_baseline/New_sim/data_laplace/mumuz_cop.mat';