From 7072359241f557ad5e4eada56dbcff9ed3f10196 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?St=C3=A9phane=20Adjemian=20=28Ry=C3=BBk=29?= Date: Thu, 3 Mar 2022 21:56:44 +0100 Subject: [PATCH] Fix fifth output introduced in e815fb2 (exitflag was not updated). --- matlab/dynare_solve.m | 11 +++++------ 1 file changed, 5 insertions(+), 6 deletions(-) diff --git a/matlab/dynare_solve.m b/matlab/dynare_solve.m index 539eae7d7..e38863dee 100644 --- a/matlab/dynare_solve.m +++ b/matlab/dynare_solve.m @@ -193,7 +193,7 @@ if options.solve_algo == 0 options4fsolve.Jacobian = 'off'; end if ~isoctave - [x, ~, exitval] = fsolve(f, x, options4fsolve, arguments{:}); + [x, ~, exitflag] = fsolve(f, x, options4fsolve, arguments{:}); else % Under Octave, use a wrapper, since fsolve() does not have a 4th arg if ischar(f) @@ -205,15 +205,14 @@ if options.solve_algo == 0 % The Octave version of fsolve does not converge when it starts from the solution fvec = feval(f, x); if max(abs(fvec)) >= tolf - [x, ~,exitval] = fsolve(f, x, options4fsolve); + [x, ~, exitflag] = fsolve(f, x, options4fsolve); else - exitval = 3; + exitflag = 3; end end - - if exitval == 1 + if exitflag == 1 errorflag = false; - elseif exitval > 1 + elseif exitflag > 1 if ischar(f) f2 = str2func(f); else