From 9cf83b6e63fbf2f302c67ee341905143b7532e6e Mon Sep 17 00:00:00 2001 From: Johannes Pfeifer <jpfeifer@gmx,de> Date: Tue, 1 Apr 2014 14:39:19 +0200 Subject: [PATCH] Add check to model_diagnostics.m whether Hessian was computed --- matlab/model_diagnostics.m | 9 +++++---- 1 file changed, 5 insertions(+), 4 deletions(-) diff --git a/matlab/model_diagnostics.m b/matlab/model_diagnostics.m index 197953fe1..92122514f 100644 --- a/matlab/model_diagnostics.m +++ b/matlab/model_diagnostics.m @@ -209,11 +209,12 @@ if any(any(isinf(jacobia_) | isnan(jacobia_))) fprintf('\nMODEL_DIAGNOSTICS: The Jacobian of the dynamic model contains Inf or NaN. The problem arises from: \n\n') display_problematic_vars_Jacobian(infrow,infcol,M,dr.ys,'dynamic','MODEL_DIAGNOSTICS: ') end -if any(any(isinf(hessian1) | isnan(hessian1))) - problem_dummy=1; - fprintf('\nMODEL_DIAGNOSTICS: The Hessian of the dynamic model contains Inf or NaN.\n') +if exist('hessian1','var') + if any(any(isinf(hessian1) | isnan(hessian1))) + problem_dummy=1; + fprintf('\nMODEL_DIAGNOSTICS: The Hessian of the dynamic model contains Inf or NaN.\n') + end end - if problem_dummy==0 fprintf('MODEL_DIAGNOSTICS: No obvious problems with this mod-file were detected.\n') end -- GitLab