From c309b0cf57d5a20a168457c145a5276ae1ae18f1 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?St=C3=A9phane=20Adjemian=20=28Charybdis=29?= Date: Wed, 21 Sep 2011 08:30:26 +0200 Subject: [PATCH] Fixed bug related to the initialization of the persistent variable. --- matlab/DsgeLikelihood.m | 16 ++++++++-------- 1 file changed, 8 insertions(+), 8 deletions(-) diff --git a/matlab/DsgeLikelihood.m b/matlab/DsgeLikelihood.m index 6f255662c..8bc790734 100644 --- a/matlab/DsgeLikelihood.m +++ b/matlab/DsgeLikelihood.m @@ -126,26 +126,26 @@ function [fval,exit_flag,ys,trend_coeff,info,Model,DynareOptions,BayesInfo,Dynar % AUTHOR(S) stephane DOT adjemian AT univ DASH lemans DOT FR -% Initialization of the returned variables and others... -fval = []; -ys = []; -trend_coeff = []; -exit_flag = 1; -info = 0; - % Declaration of the penalty as a persistent variable. persistent penalty % Initialization of the persistent variable. if ~nargin || isempty(penalty) penalty = 1e8; - return + if ~nargin, return, end end if nargin==1 penalty = xparam1; return end +% Initialization of the returned variables and others... +fval = []; +ys = []; +trend_coeff = []; +exit_flag = 1; +info = 0; + % Set flag related to analytical derivatives. if nargout > 9 analytic_derivation=1;