comparison toolboxes/FullBNT-1.0.7/KPMtools/genpathKPM.m @ 0:e9a9cd732c1e tip

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