annotate _FullBNT/KPMtools/genpathKPM.m @ 9:4ea6619cb3f5 tip

removed log files
author matthiasm
date Fri, 11 Apr 2014 15:55:11 +0100
parents b5b38998ef3b
children
rev   line source
matthiasm@8 1 function p = genpathKPM(d)
matthiasm@8 2 % genpathKPM Like built-in genpath, but omits directories whose name is 'Old', 'old' or 'CVS'
matthiasm@8 3 % function p = genpathKPM(d)
matthiasm@8 4
matthiasm@8 5 if nargin==0,
matthiasm@8 6 p = genpath(fullfile(matlabroot,'toolbox'));
matthiasm@8 7 if length(p) > 1, p(end) = []; end % Remove trailing pathsep
matthiasm@8 8 return
matthiasm@8 9 end
matthiasm@8 10
matthiasm@8 11 % initialise variables
matthiasm@8 12 methodsep = '@'; % qualifier for overloaded method directories
matthiasm@8 13 p = ''; % path to be returned
matthiasm@8 14
matthiasm@8 15 % Generate path based on given root directory
matthiasm@8 16 files = dir(d);
matthiasm@8 17 if isempty(files)
matthiasm@8 18 return
matthiasm@8 19 end
matthiasm@8 20
matthiasm@8 21 % Add d to the path even if it is empty.
matthiasm@8 22 p = [p d pathsep];
matthiasm@8 23
matthiasm@8 24 % set logical vector for subdirectory entries in d
matthiasm@8 25 isdir = logical(cat(1,files.isdir));
matthiasm@8 26 %
matthiasm@8 27 % Recursively descend through directories which are neither
matthiasm@8 28 % private nor "class" directories.
matthiasm@8 29 %
matthiasm@8 30 dirs = files(isdir); % select only directory entries from the current listing
matthiasm@8 31
matthiasm@8 32 for i=1:length(dirs)
matthiasm@8 33 dirname = dirs(i).name;
matthiasm@8 34 if ~strcmp( dirname,'.') & ...
matthiasm@8 35 ~strcmp( dirname,'..') & ...
matthiasm@8 36 ~strncmp( dirname,methodsep,1)& ...
matthiasm@8 37 ~strcmp( dirname,'private') & ...
matthiasm@8 38 ~strcmp( dirname, 'old') & ... % KPM
matthiasm@8 39 ~strcmp( dirname, 'Old') & ... % KPM
matthiasm@8 40 ~strcmp( dirname, 'CVS') % KPM
matthiasm@8 41 p = [p genpathKPM(fullfile(d,dirname))]; % recursive calling of this function.
matthiasm@8 42 end
matthiasm@8 43 end
matthiasm@8 44
matthiasm@8 45 %------------------------------------------------------------------------------