Remove calls to eval.
parent
eb043406e6
commit
47af0cde16
|
@ -56,7 +56,8 @@ elseif NumberOfPlots == 1
|
|||
end
|
||||
|
||||
for plt = 1:NumberOfPlots
|
||||
eval(['NumberOfCurves = Info.Box' int2str(plt) '.Number;'])
|
||||
field1 = sprintf('Box%u', plt);
|
||||
NumberOfCurves = Info.(field1).Number;
|
||||
NumberOfObservations = zeros(2,1);
|
||||
x = cell(NumberOfCurves,1);
|
||||
y = cell(NumberOfCurves,1);
|
||||
|
@ -66,10 +67,11 @@ for plt = 1:NumberOfPlots
|
|||
binf = NaN(NumberOfCurves,1);
|
||||
bsup = NaN(NumberOfCurves,1);
|
||||
for curve = 1:NumberOfCurves
|
||||
eval(['x{' curve '} = Info.Box' int2str(plt) '.Curve' int2str(curve) '.xdata;'])
|
||||
eval(['y{' curve '} = Info.Box' int2str(plt) '.Curve' int2str(curve) '.ydata;'])
|
||||
eval(['name = Info.Box' int2str(plt) '.Curve' int2str(curve) '.variablename;'])
|
||||
eval(['PltType{' curve '} = Info.Box' int2str(plt) '.Curve' int2str(curve) '.type']);
|
||||
field2 = sprintf('Curve%u', curve);
|
||||
x{curve} = Info.(field1).(field2).xdata;
|
||||
y{curve} = Info.(field1).(field2).ydata;
|
||||
name = Info.(field1).(field2).variablename;
|
||||
PltType{curve} = Info.(field1).(field2).type;
|
||||
if length(x{curve})-length(y{curve})
|
||||
disp('MakeFigure :: The number of observations in x doesn''t match with ')
|
||||
disp(['the number of observation in y for ' name ])
|
||||
|
@ -90,9 +92,9 @@ for plt = 1:NumberOfPlots
|
|||
if isnan(ymin(plt))
|
||||
ymin = 0;
|
||||
end
|
||||
eval(['NAMES{' int2str(plt) '} = Info.Box' int2str(plt) '.name;'])
|
||||
NAMES{plt} = Info.(field1).name;
|
||||
if options_.TeX
|
||||
eval(['TeXNAMES{' int2str(plt) '} = Info.Box' int2str(plt) '.texname;'])
|
||||
TeXNAMES{plt} = Info.(field1).texname;
|
||||
end
|
||||
subplot(nr,nc,plt)
|
||||
hold on
|
||||
|
@ -148,22 +150,24 @@ end
|
|||
|
||||
if Info.SaveFormat.Eps
|
||||
if isempty(Info.SaveFormat.Name)
|
||||
eval(['print -depsc2 ' M_.fname Info.SaveFormat.GenericName int2str(Info.SaveFormat.Number) '.eps']);
|
||||
print(sprintf('%s%s%u', M_.fname, Info.SaveFormat.GenericName, Info.SaveFormat.Number), '-depsc2')
|
||||
else
|
||||
eval(['print -depsc2 ' M_.fname Info.SaveFormat.GenericName Info.SaveFormat.Name '.eps']);
|
||||
print(sprintf('%s%s%s', M_.fname, Info.SaveFormat.GenericName, Info.SaveFormat.Name), '-depsc2')
|
||||
end
|
||||
end
|
||||
|
||||
if Info.SaveFormat.Pdf && ~isoctave
|
||||
if isempty(Info.SaveFormat.Name)
|
||||
eval(['print -dpdf ' M_.fname Info.SaveFormat.GenericName int2str(Info.SaveFormat.Number)]);
|
||||
print(sprintf('%s%s%u', M_.fname, Info.SaveFormat.GenericName, Info.SaveFormat.Number), '-dpdf')
|
||||
else
|
||||
eval(['print -dpdf ' M_.fname Info.SaveFormat.GenericName Info.SaveFormat.Name]);
|
||||
print(sprintf('%s%s%s', M_.fname, Info.SaveFormat.GenericName, Info.SaveFormat.Name), '-dpdf')
|
||||
end
|
||||
end
|
||||
|
||||
if Info.SaveFormat.Fig && ~isoctave
|
||||
if isempty(Info.SaveFormat.Name)
|
||||
saveas(FigHandle,[M_.fname Info.SaveFormat.GenericName int2str(Info.SaveFormat.Number) '.fig']);
|
||||
saveas(FigHandle, sprintf('%s%s%u.fig', M_.fname, Info.SaveFormat.GenericName, Info.SaveFormat.Number));
|
||||
else
|
||||
saveas(FigHandle,[M_.fname Info.SaveFormat.GenericName Info.SaveFormat.Name '.fig']);
|
||||
saveas(FigHandle, sprintf('%s%s%s.fig', M_.fname, Info.SaveFormat.GenericName, Info.SaveFormat.Name));
|
||||
end
|
||||
end
|
||||
end
|
||||
|
|
|
@ -103,6 +103,6 @@ for taper_index=1:length(taper_steps)
|
|||
results_vec(1,4+taper_index*2-1)=NSE_taper;
|
||||
results_vec(1,4+taper_index*2)=total_variance/(n_draws_used*NSE_taper^2);
|
||||
|
||||
eval(['results_struct.nse_taper_',num2str(taper),'= NSE_taper;']);
|
||||
eval(['results_struct.rne_taper_',num2str(taper),'= total_variance/(n_draws_used*NSE_taper^2);']);
|
||||
results_struct.(sprintf('nse_taper_%u', taper)) = NSE_taper;
|
||||
results_struct.(sprintf('rne_taper_%u', taper)) = total_variance/(n_draws_used*NSE_taper^2);
|
||||
end % end of for mm loop
|
||||
|
|
|
@ -72,8 +72,8 @@ if np
|
|||
fprintf('%-*s %10.4f %7.4f %7.4f \n', ...
|
||||
header_width, name, xparam1(ip), stdh(ip), tstath(ip));
|
||||
end
|
||||
eval(['oo_.' field_name '_mode.parameters.' name ' = xparam1(ip);']);
|
||||
eval(['oo_.' field_name '_std_at_mode.parameters.' name ' = stdh(ip);']);
|
||||
oo_.(sprintf('%s_mode', field_name)).parameters.(name) = xparam1(ip);
|
||||
oo_.(sprintf('%s_std_at_mode', field_name)).parameters.(name) = stdh(ip);
|
||||
ip = ip+1;
|
||||
end
|
||||
skipline()
|
||||
|
@ -94,8 +94,8 @@ if nvx
|
|||
fprintf('%-*s %10.4f %7.4f %7.4f \n', header_width, name, xparam1(ip), stdh(ip), tstath(ip));
|
||||
end
|
||||
M_.Sigma_e(k,k) = xparam1(ip)*xparam1(ip);
|
||||
eval(['oo_.' field_name '_mode.shocks_std.' name ' = xparam1(ip);']);
|
||||
eval(['oo_.' field_name '_std_at_mode.shocks_std.' name ' = stdh(ip);']);
|
||||
oo_.(sprintf('%s_mode', field_name)).shocks_std.(name) = xparam1(ip);
|
||||
oo_.(sprintf('%s_std_at_mode', field_name)).shocks_std.(name) = stdh(ip);
|
||||
ip = ip+1;
|
||||
end
|
||||
skipline()
|
||||
|
@ -116,8 +116,8 @@ if nvn
|
|||
fprintf('%-*s %10.4f %7.4f %7.4f \n', header_width, name, xparam1(ip), ...
|
||||
stdh(ip), tstath(ip))
|
||||
end
|
||||
eval(['oo_.' field_name '_mode.measurement_errors_std.' name ' = xparam1(ip);']);
|
||||
eval(['oo_.' field_name '_std_at_mode.measurement_errors_std.' name ' = stdh(ip);']);
|
||||
oo_.(sprintf('%s_mode', field_name)).measurement_errors_std.(name) = xparam1(ip);
|
||||
oo_.(sprintf('%s_std_at_mode', field_name)).measurement_errors_std.(name) = stdh(ip);
|
||||
ip = ip+1;
|
||||
end
|
||||
skipline()
|
||||
|
@ -142,8 +142,8 @@ if ncx
|
|||
end
|
||||
M_.Sigma_e(k1,k2) = xparam1(ip)*sqrt(M_.Sigma_e(k1,k1)*M_.Sigma_e(k2,k2));
|
||||
M_.Sigma_e(k2,k1) = M_.Sigma_e(k1,k2);
|
||||
eval(['oo_.' field_name '_mode.shocks_corr.' NAME ' = xparam1(ip);']);
|
||||
eval(['oo_.' field_name '_std_at_mode.shocks_corr.' NAME ' = stdh(ip);']);
|
||||
oo_.(sprintf('%s_mode', field_name)).shocks_corr.(name) = xparam1(ip);
|
||||
oo_.(sprintf('%s_std_at_mode', field_name)).shocks_corr.(name) = stdh(ip);
|
||||
ip = ip+1;
|
||||
end
|
||||
skipline()
|
||||
|
@ -166,8 +166,8 @@ if ncn
|
|||
fprintf('%-*s %10.4f %7.4f %7.4f \n',header_width, name, xparam1(ip), ...
|
||||
stdh(ip), tstath(ip));
|
||||
end
|
||||
eval(['oo_.' field_name '_mode.measurement_errors_corr.' NAME ' = xparam1(ip);']);
|
||||
eval(['oo_.' field_name '_std_at_mode.measurement_errors_corr.' NAME ' = stdh(ip);']);
|
||||
oo_.(sprintf('%s_mode', field_name)).measurement_errors_corr.(name) = xparam1(ip);
|
||||
oo_.(sprintf('%s_std_at_mode', field_name)).measurement_errors_corr.(name) = stdh(ip);
|
||||
ip = ip+1;
|
||||
end
|
||||
skipline()
|
||||
|
@ -407,4 +407,4 @@ function TeXEnd(fid)
|
|||
fprintf(fid,'\\end{longtable}\n ');
|
||||
fprintf(fid,'\\end{center}\n');
|
||||
fprintf(fid,'%% End of TeX file.\n');
|
||||
fclose(fid);
|
||||
fclose(fid);
|
||||
|
|
|
@ -87,7 +87,7 @@ for i=1:NumberOfModels
|
|||
end
|
||||
end
|
||||
try
|
||||
eval(['MarginalLogDensity(i) = mstruct.oo_.MarginalDensity.' type ';'])
|
||||
MarginalLogDensity(i) = mstruct.oo_.MarginalDensity.(type);
|
||||
catch
|
||||
if strcmpi(type,'LaplaceApproximation')
|
||||
if isfield(mstruct.oo_,'mle_mode')
|
||||
|
|
|
@ -36,24 +36,24 @@ function indx = get_new_or_existing_ei_index(substructure_name, name1, name2)
|
|||
|
||||
global estimation_info
|
||||
|
||||
if eval(['isempty(estimation_info.' substructure_name ')'])
|
||||
if isempty(estimation_info.(substructure_name))
|
||||
indx = 1;
|
||||
return
|
||||
end
|
||||
|
||||
if isempty(name2) % parameter or std() statement
|
||||
indx = eval(['find(strcmp(name1, estimation_info.' substructure_name ') == 1)']);
|
||||
indx = find(strcmp(name1, estimation_info.(substructure_name)));
|
||||
else % corr statement
|
||||
indx = eval(['find(strcmp([''' name1 ':' name2 '''], estimation_info.' substructure_name ') == 1)']);
|
||||
indx = find(strcmp(sprintf('%s:%s', name1, name2), estimation_info.(substructure_name)));
|
||||
if isempty(indx)
|
||||
indx = eval(['find(strcmp([''' name2 ':' name1 '''], estimation_info.' substructure_name ') == 1)']);
|
||||
indx = find(strcmp(sprintf('%s:%s', name2, name1), estimation_info.(substructure_name)));
|
||||
end
|
||||
end
|
||||
|
||||
if isempty(indx)
|
||||
indx = eval(['size(estimation_info.' substructure_name ', 2) + 1']);
|
||||
indx = size(estimation_info.(substructure_name), 2) + 1;
|
||||
end
|
||||
|
||||
if size(indx, 2) > 1
|
||||
error(['Error: ' name1 ' ' name2 'found more than once in estimation_info.subsamples_index']);
|
||||
error('Error: %s %s found more than once in estimation_info.subsamples_index', name1, name2);
|
||||
end
|
||||
|
|
|
@ -31,14 +31,14 @@ function storeGlobalVars(fname,append)
|
|||
|
||||
|
||||
GlobalNames = who('global');
|
||||
% varlist = '';
|
||||
|
||||
for j=1:length(GlobalNames)
|
||||
eval(['global ',GlobalNames{j},';']);
|
||||
eval(['fGlobalVar.',GlobalNames{j},'=',GlobalNames{j},';']);
|
||||
fGlobalvar.(GlobalNames{j}) = GlobalNames{j};
|
||||
end
|
||||
|
||||
if nargin<2
|
||||
save(fname,'fGlobalVar');
|
||||
else
|
||||
save(fname,'fGlobalVar','-append');
|
||||
end
|
||||
end
|
||||
|
|
Loading…
Reference in New Issue