diff --git a/compat/incorrect/README b/compat/incorrect/README new file mode 100644 index 0000000000..80af7cb06f --- /dev/null +++ b/compat/incorrect/README @@ -0,0 +1,4 @@ +This is a directory that should never be added to your MATLAB path. +It only serves to check whether your path is setup incorrectly. + +See also http://www.fieldtriptoolbox.org/faq/should_i_add_fieldtrip_with_all_subdirectories_to_my_matlab_path diff --git a/compat/matlablt2010b/README b/compat/matlablt2010b/README new file mode 100644 index 0000000000..eb715fb302 --- /dev/null +++ b/compat/matlablt2010b/README @@ -0,0 +1,12 @@ +This directory contains some functions that allow FieldTrip to run +on older MATLAB versions. These functions emulate the functionality +that is present in the latest MATLAB version. + +Each of these directories is called matlabltXXXXX, where "lt" stands +for "less than" and XXXXX is the MATLAB release. If you are using +MATLAB release N, then you should only add the directories N+1, +N+2, ... to your path. In general this will be done automatically +by the ft_defaults function. + +See also http://www.fieldtriptoolbox.org/faq/should_i_add_fieldtrip_with_all_subdirectories_to_my_matlab_path + diff --git a/compat/matlablt2011b/README b/compat/matlablt2011b/README new file mode 100644 index 0000000000..a371a10f45 --- /dev/null +++ b/compat/matlablt2011b/README @@ -0,0 +1,11 @@ +This directory contains some functions that allow FieldTrip to run +on older MATLAB versions. These functions emulate the functionality +that is present in the latest MATLAB version. + +Each of these directories is called matlabltXXXXX, where "lt" stands +for "less than" and XXXXX is the MATLAB release. If you are using +MATLAB release N, then you should only add the directories N+1, +N+2, ... to your path. In general this will be done automatically +by the ft_defaults function. + +See also http://www.fieldtriptoolbox.org/faq/should_i_add_fieldtrip_with_all_subdirectories_to_my_matlab_path diff --git a/compat/matlablt2012a/README b/compat/matlablt2012a/README new file mode 100644 index 0000000000..a371a10f45 --- /dev/null +++ b/compat/matlablt2012a/README @@ -0,0 +1,11 @@ +This directory contains some functions that allow FieldTrip to run +on older MATLAB versions. These functions emulate the functionality +that is present in the latest MATLAB version. + +Each of these directories is called matlabltXXXXX, where "lt" stands +for "less than" and XXXXX is the MATLAB release. If you are using +MATLAB release N, then you should only add the directories N+1, +N+2, ... to your path. In general this will be done automatically +by the ft_defaults function. + +See also http://www.fieldtriptoolbox.org/faq/should_i_add_fieldtrip_with_all_subdirectories_to_my_matlab_path diff --git a/compat/matlablt2013b/README b/compat/matlablt2013b/README new file mode 100644 index 0000000000..a371a10f45 --- /dev/null +++ b/compat/matlablt2013b/README @@ -0,0 +1,11 @@ +This directory contains some functions that allow FieldTrip to run +on older MATLAB versions. These functions emulate the functionality +that is present in the latest MATLAB version. + +Each of these directories is called matlabltXXXXX, where "lt" stands +for "less than" and XXXXX is the MATLAB release. If you are using +MATLAB release N, then you should only add the directories N+1, +N+2, ... to your path. In general this will be done automatically +by the ft_defaults function. + +See also http://www.fieldtriptoolbox.org/faq/should_i_add_fieldtrip_with_all_subdirectories_to_my_matlab_path diff --git a/compat/matlablt2014b/README b/compat/matlablt2014b/README new file mode 100644 index 0000000000..a371a10f45 --- /dev/null +++ b/compat/matlablt2014b/README @@ -0,0 +1,11 @@ +This directory contains some functions that allow FieldTrip to run +on older MATLAB versions. These functions emulate the functionality +that is present in the latest MATLAB version. + +Each of these directories is called matlabltXXXXX, where "lt" stands +for "less than" and XXXXX is the MATLAB release. If you are using +MATLAB release N, then you should only add the directories N+1, +N+2, ... to your path. In general this will be done automatically +by the ft_defaults function. + +See also http://www.fieldtriptoolbox.org/faq/should_i_add_fieldtrip_with_all_subdirectories_to_my_matlab_path diff --git a/compat/matlablt2015a/README b/compat/matlablt2015a/README new file mode 100644 index 0000000000..a371a10f45 --- /dev/null +++ b/compat/matlablt2015a/README @@ -0,0 +1,11 @@ +This directory contains some functions that allow FieldTrip to run +on older MATLAB versions. These functions emulate the functionality +that is present in the latest MATLAB version. + +Each of these directories is called matlabltXXXXX, where "lt" stands +for "less than" and XXXXX is the MATLAB release. If you are using +MATLAB release N, then you should only add the directories N+1, +N+2, ... to your path. In general this will be done automatically +by the ft_defaults function. + +See also http://www.fieldtriptoolbox.org/faq/should_i_add_fieldtrip_with_all_subdirectories_to_my_matlab_path diff --git a/compat/matlablt2016b/README b/compat/matlablt2016b/README new file mode 100644 index 0000000000..a371a10f45 --- /dev/null +++ b/compat/matlablt2016b/README @@ -0,0 +1,11 @@ +This directory contains some functions that allow FieldTrip to run +on older MATLAB versions. These functions emulate the functionality +that is present in the latest MATLAB version. + +Each of these directories is called matlabltXXXXX, where "lt" stands +for "less than" and XXXXX is the MATLAB release. If you are using +MATLAB release N, then you should only add the directories N+1, +N+2, ... to your path. In general this will be done automatically +by the ft_defaults function. + +See also http://www.fieldtriptoolbox.org/faq/should_i_add_fieldtrip_with_all_subdirectories_to_my_matlab_path diff --git a/compat/matlablt2017b/README b/compat/matlablt2017b/README new file mode 100644 index 0000000000..a371a10f45 --- /dev/null +++ b/compat/matlablt2017b/README @@ -0,0 +1,11 @@ +This directory contains some functions that allow FieldTrip to run +on older MATLAB versions. These functions emulate the functionality +that is present in the latest MATLAB version. + +Each of these directories is called matlabltXXXXX, where "lt" stands +for "less than" and XXXXX is the MATLAB release. If you are using +MATLAB release N, then you should only add the directories N+1, +N+2, ... to your path. In general this will be done automatically +by the ft_defaults function. + +See also http://www.fieldtriptoolbox.org/faq/should_i_add_fieldtrip_with_all_subdirectories_to_my_matlab_path diff --git a/ft_defaults.m b/ft_defaults.m index 8d361a6553..c209fca1da 100644 --- a/ft_defaults.m +++ b/ft_defaults.m @@ -94,6 +94,11 @@ if ~isfield(ft_default.toolbox, 'stats') , ft_default.toolbox.stats = 'compat'; end % matlab or compat if ~isfield(ft_default.toolbox, 'signal'), ft_default.toolbox.signal = 'compat'; end % matlab or compat +% Some people mess up their path settings and then have +% stuff on the path that should not be there. +% The following will issue a warning +checkIncorrectPath(); + % Check whether this ft_defaults function has already been executed. Note that we % should not use ft_default itself directly, because the user might have set stuff % in that struct already prior to ft_defaults being called for the first time. @@ -316,3 +321,18 @@ function checkMultipleToolbox(toolbox, keyfile) end end % function checkMultipleToolbox +%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% +% SUBFUNCTION +%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% +function checkIncorrectPath + +persistent v p +if isempty(v) || isempty(p) + [v, p] = ft_version; +end + +incorrect = fullfile(p, 'compat', 'incorrect'); +if contains(path, incorrect) + ft_warning('Your path is set up incorrectly.\nYou probably used addpath(genpath(''path_to_fieldtrip'')).\nThis can lead to unexpected behaviour.\nSee http://www.fieldtriptoolbox.org/faq/should_i_add_fieldtrip_with_all_subdirectories_to_my_matlab_path'); +end +end % function checkPath