rbmatlab  1.16.09
 All Classes Namespaces Files Functions Variables Modules Pages
comsol_load.m
1 function comsol_load(load_name)
2 %function comsol_load(load_name)
3 %
4 % Loads saved (comsol) data from a file. The filename is given in 'loadname'.
5 % There must exist two files: load_name.mat and load_name_cmodel.mph
6 % See also comsol_save.m
7 %
8 %Oliver Zeeb, 2012/11/30
9 
10 %load all the variables in this local funtion and add the comsol_model to
11 %those structures, which shall contain it!
12 load(load_name);
13 varnames = who;
14 cmodel_temp = mphload([load_name,'_cmodel.mph']);
15 for k=1:length(varnames)
16  if isstruct(eval(varnames{k}))
17  if isfield(eval(varnames{k}), 'comsol_model')
18  eval([varnames{k},'.comsol_model = cmodel_temp;']);
19  end
20  end
21 end
22 
23 %assign the data in the caller-workspace
24 for k=1:length(varnames)
25  assignin('caller',varnames{k}, eval(varnames{k}));
26 end
27 
28 %deletes the string containing the load name
29 evalin('caller','clear load_name;');