

%% Reaction Section
Utrain = U.tra.tot;
xtrain = x.tra.tot;
save([dirsave 'Paper\Rea_' datestr(date,'yyyymmdd') '_AddSamp_dep_diff_all_LHSaug.mat'],'Utrain','xtrain','ind','lbmub','opt','Np','n')

if ~Ver.ValLoad
    Uval = U.val.tot;
    xval = x.val.tot;
    save([dirsave 'Rea_' datestr(date,'yyyymmdd') '_1e4RND_dep.mat'],'Uval','xval','ind','lbmub','optval')
end

Rea.Var = Var;
Rea.combnet = combnet(end,:);
Rea.mult    = mult(end,:);
Rea.err.lin = cell2mat(err.lin(:,end)');
Rea.err.val = cell2mat(err.val(:,end)');
Rea.err.tra = cell2mat(err.tra(:,end)');
Rea.err.norm = cell2mat(err.norm(:,end)');
Rea.err.combval = cell2mat(err.comb.val(:,end)');
Rea.err.comblin = cell2mat(err.comb.lin(:,end)');
Rea.err.RMSE_val = cell2mat(RMSE.val(:,end)');
Rea.err.MSE_val  = cell2mat(MSE.val(:,end)');
Rea.Ver     = rmfield(Ver,{'TraLoad','ValLoad','Lid','model','Ver','add'});
save([dirsave 'Paper\Rea_Net_' datestr(date,'yyyymmdd') '_AddSamp_dep_diff_all_LHSaug.mat'],'Rea')


%% Separation Section
Utrain = U.tra.tot;
xtrain = x.tra.tot;
save([dirsave 'Paper\Sep_' datestr(date,'yyyymmdd') '_AddSamp_dep_diff_all_LHSaug.mat'],'Utrain','xtrain','ind','lbmub','opt','Np','n')

if ~Ver.ValLoad
    Uval = U.val.tot;
    xval = x.val.tot;
    save([dirsave 'Sep_' datestr(date,'yyyymmdd') '_1e4RND_dep.mat'],'Uval','xval','ind','lbmub','optval')
end

Sep.Var = Var;
Sep.combnet = combnet(end,:);
Sep.mult    = mult(end,:);
Sep.err.lin = cell2mat(err.lin(:,end)');
Sep.err.val = cell2mat(err.val(:,end)');
Sep.err.tra = cell2mat(err.tra(:,end)');
Sep.err.norm = cell2mat(err.norm(:,end)');
Sep.err.combval = cell2mat(err.comb.val(:,end)');
Sep.err.comblin = cell2mat(err.comb.lin(:,end)');
Sep.err.RMSE_val = cell2mat(RMSE.val(:,end)');
Sep.err.MSE_val  = cell2mat(MSE.val(:,end)');
Sep.Ver     = rmfield(Ver,{'TraLoad','ValLoad','Lid','model','Ver','add'});
save([dirsave 'Paper\Sep_Net_' datestr(date,'yyyymmdd') '_AddSamp_dep_diff_all_LHSaug.mat'],'Sep')


%% Pipe
Utrain = U.tra.tot;
xtrain = x.tra.tot;
save([dirsave 'Paper\Pip5_' datestr(date,'yyyymmdd') '_AddSamp_dep_diff_ind.mat'],'Utrain','xtrain','ind','lbmub','opt','Np','n')

if ~Ver.ValLoad
    Uval = U.val.tot;
    xval = x.val.tot;
    save(['Pip5_' datestr(date,'yyyymmdd') '_1e4RND_dep.mat'],'Uval','xval','ind','lbmub','optval')
end

Pip.Var = Var;
Pip.combnet = combnet(end,:);
Pip.mult    = mult(end,:);
Pip.err     = struct('lin',err.lin{end},'val',err.val{end},'tra',err.tra{end},...
                     'combval',err.comb.val{end},'comblin',err.comb.lin{end});
Pip.Ver     = rmfield(Ver,{'TraLoad','ValLoad','Lid','model','Ver','add'});
save([dirsave 'Paper\Pip5_Net_' datestr(date,'yyyymmdd') '_AddSamp_dep_diff_ind.mat'],'Pip')