I want to save the result of the q_yearly
for each case_no
in corresponding string of the q_cases_yearly
as a .mat file. With my statement of save(q_cases_yearly{case_no},'q_yearly')
even though the names of files are coming as the corresponding string of q_cases_yearly
, however all those .mat files contain variable with the same name of q_yearly
. When I open those .mat files I get a variable with name q_yearly
for all the 3 files. However, I want the names of the variables stored in those files same as the name of the files i.e. q_5wells_yearly_CMG
, q_explorwell_yearly_CMG
and q_seismic_yearly_CMG
respectively.
Here's my piece of code:
nModel=100;
nModel_want=1;
nCell=2500;
T=20;
ReservoirModel_CMGBuilder={'ReservoirModel_5wells_CMGBuilder','ReservoirModel_ExplorWell_CMGBuilder','ReservoirModel_Seismic_CMGBuilder'};
poro_models_gslib_file={'poro_models_5wells_gslib_format','poro_models_explorwell_gslib_format','poro_models_seismic_gslib_format'};
perm_models_gslib_file={'perm_models_5wells_gslib_format','perm_models_explorwell_gslib_format','perm_models_seismic_gslib_format'};
poro_model_inc_file={'poro_model_5wells','poro_model_explorwell','poro_model_seismic'};
perm_model_inc_file={'perm_model_5wells','perm_model_explorwell','perm_model_seismic'};
Reportq={'Reportq_5wells','Reportq_explorwell','Reportq_seismic'};
q_cases_yearly={'q_5wells_yearly_CMG','q_explorwell_yearly_CMG','q_seismic_yearly_CMG'};
Swav_cases_yearly={'Swav_5wells_yearly_CMG','Swav_explorwell_yearly_CMG','Swav_seismic_yearly_CMG'};
for case_no=1:length(ReservoirModel_CMGBuilder)
[q_yearly,Swav_yearly]=q_from_CMG_general(nModel,nModel_want,nCell,T,ReservoirModel_CMGBuilder{case_no},poro_models_gslib_file{case_no},perm_models_gslib_file{case_no},poro_model_inc_file{case_no},perm_model_inc_file{case_no},Reportq{case_no});
save(q_cases_yearly{case_no},'q_yearly');
save(Swav_cases_yearly{case_no},'q_yearly');
end