0001 function configMdt(isPermanent, enforce)
0002
0003
0004
0005
0006
0007
0008
0009
0010
0011
0012
0013
0014
0015
0016
0017
0018
0019
0020
0021
0022
0023
0024
0025
0026
0027 pathList = {'', ...
0028 'variable', ...
0029 'function', ...
0030 'graphic', ...
0031 'database', ...
0032 'tag-parser', ...
0033 ['extern' filesep 'm2html']};
0034
0035
0036
0037 if ~exist('isPermanent', 'var')
0038 isPermanent = 0;
0039 end
0040
0041 if ~exist('enforce', 'var')
0042 enforce = 0;
0043 end
0044
0045 if enforce ~= 1
0046 switch isPermanent
0047 case 0
0048 disp('The paths of this project are added to search paths.');
0049 case 1
0050 disp('The paths of this project are added permanently to search paths.')
0051 disp('This will also save path modifications you already did this session')
0052 confirm = input('Is this OK? [Y/N]: ', 's');
0053 disp(' ')
0054 case -1
0055 disp('The paths of this project are removed permanently from search paths.')
0056 disp('This will also save path modifications you already did this session')
0057 confirm = input('Is this OK? [Y/N]: ', 's');
0058 disp(' ')
0059 otherwise
0060 error(['The parameter ' num2str(isPermanent) ' has no meaning']);
0061 end
0062 else
0063 confirm = 'y';
0064 end
0065
0066
0067 callLocation = pwd;
0068 myLocation = which('configMdt');
0069 myLocation = myLocation(1:find(myLocation == '/', 1, 'last'));
0070 cd(myLocation);
0071
0072
0073 for iPathList = 1:length(pathList)
0074 if isPermanent >= 0
0075
0076 addpath(fullfile(cd, pathList{iPathList}));
0077 else
0078
0079 rmpath(fullfile(cd, pathList{iPathList}));
0080 end
0081 end
0082
0083
0084 if abs(isPermanent) == 1 && strcmpi(confirm, 'y')
0085 savepath
0086 end
0087
0088
0089 cd(callLocation);