I just wanted to let you know about a possible bug I stumbled upon while trying to run a code on the latest version of Dynare. The code in question runs very well in previous versions of this software. However, I got the following error message when I tried to run it on version 4.2.4:

??? Error using ==> dynare_solve at 42
You can’t use solve_algo=0 since you don’t have MATLAB’s Optimization Toolbox

I guess it would be good for you to check whether there is any incompatibility with MATLAB’s Optimization Toolbox.

Hi, this is a bug in the way we were testing for the existence of a license in Matlab. It has been fixed in the unstable branch on Dec 19. To fix it, you can replace lines 41-43 of dynare_solve.m with the code below. Similar fixes were applied in solve_one_boundary.m and dynare_config.m.

if ~exist('OCTAVE_VERSION')
[has_optimization_toolbox junk] = license('checkout','optimization_toolbox');
if ~has_optimization_toolbox
error('You can''t use solve_algo=0 since you don''t have MATLAB''s Optimization Toolbox')
end
end

Yes, there is a problem with the previous solution because it’s only valid for Matlab version >= 2011a. A solution that works for all Matlab versions >= 7.0 is as follows:

In dynare_solve.m, enter:

Then, add a file called user_has_matlab_license.m with the following code:

function [hasLicense] = user_has_matlab_license(toolbox)
%[hasLicense] = user_has_matlab_license(toolbox)
% checks for license using the appropriate function call
%
% INPUTS
% toolbox: string for toolbox name
%
% OUTPUTS
% hasLicense: bool indicating whether or not the user has the license
%
% SPECIAL REQUIREMENTS
% none
% Copyright (C) 2012 Dynare Team
%
% This file is part of Dynare.
%
% Dynare is free software: you can redistribute it and/or modify
% it under the terms of the GNU General Public License as published by
% the Free Software Foundation, either version 3 of the License, or
% (at your option) any later version.
%
% Dynare is distributed in the hope that it will be useful,
% but WITHOUT ANY WARRANTY; without even the implied warranty of
% MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
% GNU General Public License for more details.
%
% You should have received a copy of the GNU General Public License
% along with Dynare. If not, see <http://www.gnu.org/licenses/>.
if matlab_ver_less_than('7.12')
hasLicense = license('test', toolbox);
else
[hasLicense ~] = license('checkout',toolbox);
end
end

Similar changes need to be made to dynare_config.m and solve_one_boundary.m. If you are comfortable with git, you can see the changes on the 4.2 branch in commit 5a580341337e51fcf17a4a877201a3bbf0be59d4