From 25243712ba1456596acfdca8d81037911bea02c0 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?St=C3=A9phane=20Adjemian=20=28Hermes=29?= Date: Fri, 17 Jun 2016 21:59:29 +0200 Subject: [PATCH] Fixed bug on non linux platforms + Cosmetic changes. The paths to mex files was wrong. --- matlab/add_path_to_mex_files.m | 2 +- matlab/dynare_config.m | 26 ++++++++++++++++---------- 2 files changed, 17 insertions(+), 11 deletions(-) diff --git a/matlab/add_path_to_mex_files.m b/matlab/add_path_to_mex_files.m index 6d97eabdd..25886c844 100644 --- a/matlab/add_path_to_mex_files.m +++ b/matlab/add_path_to_mex_files.m @@ -69,7 +69,7 @@ else end % Add generic MATLAB path (with higher priority than the previous ones) if exist('mexpath') - mexpath = { mexpath, [dynareroot '../mex/matlab/'] }; + mexpath = { mexpath; [dynareroot '../mex/matlab/'] }; else mexpath = { [dynareroot '../mex/matlab/'] }; end diff --git a/matlab/dynare_config.m b/matlab/dynare_config.m index 8c3633661..21ece1bae 100644 --- a/matlab/dynare_config.m +++ b/matlab/dynare_config.m @@ -107,14 +107,18 @@ if (isoctave && ~user_has_octave_forge_package('statistics')) ... p{end+1} = '/missing/nanmean'; end -P = cellfun(@(c)[dynareroot c], p, 'uni',false); +P = cellfun(@(c)[dynareroot(1:end-1) c], p, 'uni',false); -% Add mex files folder -P(end+1) = add_path_to_mex_files(dynareroot, false); +% Get mex files folder(s) +mexpaths = add_path_to_mex_files(dynareroot, false); +% Add mex files folder(s) +P(end+1:end+length(mexpaths)) = mexpaths; + +% Set matlab's path addpath(P{:}); -%% Set mex routine names +% Set mex routine names mex_status = cell(1,3); mex_status(1,1) = {'mjdgges'}; mex_status(1,2) = {'qz'}; @@ -132,9 +136,10 @@ mex_status(5,1) = {'local_state_space_iteration_2'}; mex_status(5,2) = {'reduced_form_models/local_state_space_iteration_2'}; mex_status(5,3) = {'Local state space iteration (second order)'}; number_of_mex_files = size(mex_status,1); -%% Remove some directories from matlab's path. This is necessary if the user has -%% added dynare_v4/matlab with the subfolders. Matlab has to ignore these -%% subfolders if valid mex files exist. + +% Remove some directories from matlab's path. This is necessary if the user has +% added dynare_v4/matlab with the subfolders. Matlab has to ignore these +% subfolders if valid mex files exist. matlab_path = path; for i=1:number_of_mex_files test = strfind(matlab_path,[dynareroot mex_status{i,2}]); @@ -144,8 +149,9 @@ for i=1:number_of_mex_files matlab_path = path; end end -%% Test if valid mex files are available, if a mex file is not available -%% a matlab version of the routine is included in the path. + +% Test if valid mex files are available, if a mex file is not available +% a matlab version of the routine is included in the path. if verbose skipline() disp('Configuring Dynare ...') @@ -218,4 +224,4 @@ end % Initialization of the dates and dseries classes (recursive). initialize_dseries_toolbox; -cd(origin); +cd(origin); \ No newline at end of file