annotate toolboxes/FullBNT-1.0.7/genpathKPM.m @ 0:cc4b1211e677 tip

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