diff --git a/src/initialize_dates_toolbox.m b/src/initialize_dates_toolbox.m index e51c79ce84d3a8abee42d809a3f4b5657b878b0e..48ef9b40435c2de10e837567ef5fd7019c9927db 100644 --- a/src/initialize_dates_toolbox.m +++ b/src/initialize_dates_toolbox.m @@ -1,28 +1,32 @@ % Get the path to the dates/src folder. dates_src_root = strrep(which('initialize_dates_toolbox'),'initialize_dates_toolbox.m',''); -% Add some subfolders to the path. -addpath([dates_src_root '/utilities/is']) -addpath([dates_src_root '/utilities/op']) -addpath([dates_src_root '/utilities/convert']) +% Set the subfolders to be added in the path. +p = {'/utilities/is'; ... + '/utilities/op'; ... + '/utilities/convert'}; % Add missing routines if dynare is not in the path if ~exist('isint','file') - addpath([dates_src_root '/utilities/missing/isint']) + p{end+1} = '/utilities/missing/isint'; end if ~exist('isoctave','file') - addpath([dates_src_root '/utilities/missing/isoctave']) + p{end+1} = '/utilities/missing/isoctave'; end if ~isoctave && (~exist('rows','file') || ~exist('columns','file')) - addpath([dates_src_root '/utilities/missing/dims']) + p{end+1} = '/utilities/missing/dims'; end if ~exist('shiftS','file') - addpath([dates_src_root '/utilities/missing/shiftS']) + p{end+1} = '/utilities/missing/shiftS'; end if ~exist('matlab_ver_less_than','file') - addpath([dates_src_root '/utilities/missing/matlab_ver_less_than']) -end \ No newline at end of file + p{end+1} = '/utilities/missing/matlab_ver_less_than'; +end + +% Set path +P = cellfun(@(c)[dates_src_root(1:end-1) c], p, 'uni', false); +addpath(P{:}); \ No newline at end of file