Differences

This shows you the differences between two versions of the page.

Link to this comparison view

Both sides previous revision Previous revision
Next revision
Previous revision
faq:should_i_add_fieldtrip_with_all_subdirectories_to_my_matlab_path [2018/04/25 14:16]
robert
faq:should_i_add_fieldtrip_with_all_subdirectories_to_my_matlab_path [2018/07/06 11:34] (current)
robert [Should I add FieldTrip with all subdirectories to my MATLAB path?]
Line 2: Line 2:
 ===== Should I add FieldTrip with all subdirectories to my MATLAB path? ===== ===== Should I add FieldTrip with all subdirectories to my MATLAB path? =====
  
-In general you should **not** add FieldTrip with all subdirectories to your path. There are a number of external toolboxes (in fieldtrip/​external) which are irrelevant for most users, and even can cause some problems if they overlap with other (custom) toolboxes on your path.+In general you should **not** add FieldTrip with all subdirectories to your path. There are a number of external toolboxes (in fieldtrip/​external) which are irrelevant for most users, and even can cause some problems if they overlap with other (custom) toolboxes on your path. Furthermore,​ there are some functions for backward compatibility in fieldtrip/​compat,​ which should only be added to your path in case you use an older MATLAB release.
  
 +<note warning>
 +Please be aware that you should NOT do 
 +  addpath(genpath('/​home/​user/​fieldtrip'​))
 +because that will add many toolbox directories to your path that you won't use. Furthermore,​ it potentially causes some toolboxes to be on your path twice (e.g. SPM).  ​
 +</​note>​
 +
 +==== Step 1 ====
 You should do  You should do 
   addpath <​full_path_to_fieldtrip>​   addpath <​full_path_to_fieldtrip>​
-where full_path_to_fieldtrip is the location where the fieldtrip ​directory is located. Inside the Donders Centre, this would be on Linux+where full_path_to_fieldtrip is the location where the FieldTrip ​directory is located. Inside the Donders Centre ​for Cognitive Neuroimaging, this would be on Linux
   addpath /​home/​common/​matlab/​fieldtrip   addpath /​home/​common/​matlab/​fieldtrip
 and on Windows and on Windows
Line 13: Line 20:
   addpath D:​\fieldtrip-20100228   addpath D:​\fieldtrip-20100228
  
-After adding the fieldtrip ​main path, you should execute the **[[:​reference:​ft_defaults]]** function (formerly called fieldtripdefs.m),​ which sets the defaults and configures up the minimal required path settings. ​+==== Step 2 ==== 
 + 
 +After adding the FieldTrip ​main path, you should execute the **[[:​reference:​ft_defaults]]** function (formerly called fieldtripdefs.m),​ which sets the defaults and configures up the minimal required path settings. ​
  
   ft_defaults   ft_defaults
  
-It is most convenient to have the addpath and ft_defaults ​in a startup.m scriptwhich is located in your own MATLAB directory. See [[http://​www.mathworks.com/​access/​helpdesk/​help/​techdoc/​ref/​startup.html|this information from Mathworks]].+If a subsequent FieldTrip function need an external toolbox that is present ​in fieldtrip/​externalthe **[[:reference:​ft_hastoolbox]]** function will be called by the respective function and the path will be updated on the fly.
  
-<note warning> +==== Making it persistent ==== 
-Please be aware that you should NOT do  + 
-  ​addpath(genpath('/​home/​user/​fieldtrip'​)) +It is most convenient ​to have the addpath and **[[:​reference:​ft_defaults]]** in a script with the name **startup.m**which is located in your own MATLAB directorySee [[http://​www.mathworks.com/access/​helpdesk/​help/​techdoc/​ref/​startup.html|this information from Mathworks]]. 
-because that will add many toolbox directories ​to your path that you won't useFurthermoreit potentially causes some toolboxes to be on your path twice (e.gSPM)  + 
-</note>+==== Clean up your path ====
  
 If you want to ensure that you have a clean version of the FieldTrip toolbox on your MATLAB path, please do If you want to ensure that you have a clean version of the FieldTrip toolbox on your MATLAB path, please do
Line 32: Line 41:
  
 All other dependencies will subsequently be added automatically when needed. ​ All other dependencies will subsequently be added automatically when needed. ​
- 
- 
 ===== How to deal with toolboxes that FieldTrip uses? ===== ===== How to deal with toolboxes that FieldTrip uses? =====