From 281e59e5af78471d1b00850ba839f37eeec9616f Mon Sep 17 00:00:00 2001 From: Johannes Pfeifer Date: Sun, 14 Sep 2014 19:31:55 +0200 Subject: [PATCH] Fix display_problematic_vars_Jacobian.m for cases where M_.aux_vars is empty --- matlab/display_problematic_vars_Jacobian.m | 12 +++++++++--- 1 file changed, 9 insertions(+), 3 deletions(-) diff --git a/matlab/display_problematic_vars_Jacobian.m b/matlab/display_problematic_vars_Jacobian.m index b77c60804..1abf0ba71 100644 --- a/matlab/display_problematic_vars_Jacobian.m +++ b/matlab/display_problematic_vars_Jacobian.m @@ -36,9 +36,13 @@ function []=display_problematic_vars_Jacobian(problemrow,problemcol,M_,x,type,ca if nargin<6 caller_string=''; end -aux_vars_type = [M_.aux_vars.type]; -aux_eq_nbr = max(find(aux_vars_type == 6)); -if isempty(aux_eq_nbr) +if ~isempty(M_.aux_vars) + aux_vars_type = [M_.aux_vars.type]; + aux_eq_nbr = max(find(aux_vars_type == 6)); + if isempty(aux_eq_nbr) + aux_eq_nbr=0; + end +else aux_eq_nbr=0; end if strcmp(type,'dynamic') @@ -84,6 +88,7 @@ if strcmp(type,'dynamic') fprintf('\n%s The problem most often occurs, because a variable with\n',caller_string) fprintf('%s exponent smaller than 1 has been initialized to 0. Taking the derivative\n',caller_string) fprintf('%s and evaluating it at the steady state then results in a division by 0.\n',caller_string) + fprintf('%s If you are using model-local variables (# operator), check their values as well.\n',caller_string) elseif strcmp(type,'static') for ii=1:length(problemrow) if problemcol(ii)<=M_.orig_endo_nbr @@ -119,6 +124,7 @@ elseif strcmp(type,'static') fprintf('\n%s The problem most often occurs, because a variable with\n',caller_string) fprintf('%s exponent smaller than 1 has been initialized to 0. Taking the derivative\n',caller_string) fprintf('%s and evaluating it at the steady state then results in a division by 0.\n',caller_string) + fprintf('%s If you are using model-local variables (# operator), check their values as well.\n',caller_string) else error('Unknown Type') end \ No newline at end of file