


GENPATH_ICE - generate paths in a directory
this routine is equivalent to Matlab's genpath except that it skips CVS and .svn directories
Usage:
p = genpath_ice(d)

0001 function p = genpath_ice(d) 0002 %GENPATH_ICE - generate paths in a directory 0003 % 0004 % this routine is equivalent to Matlab's genpath except that it skips CVS and .svn directories 0005 % 0006 % Usage: 0007 % p = genpath_ice(d) 0008 0009 %initialize path to be returned 0010 p = ''; 0011 sep=pathsep; %directory separator 0012 0013 % Generate path based on given root directory 0014 files=dir(d); 0015 if isempty(files) 0016 return 0017 end 0018 0019 % Add d to the path even if it is empty. 0020 p = [p d sep]; 0021 0022 % set logical vector for subdirectory entries in d 0023 isdir = logical(cat(1,files.isdir)); 0024 0025 % Recursively goes through the subdirectories of d 0026 dirs=files(isdir); % select only directory entries from the current listing 0027 for i=1:length(dirs) 0028 dirname=dirs(i).name; 0029 if ~strcmp(dirname,'.') & ... 0030 ~strcmp(dirname,'..') & ... 0031 ~strcmp(dirname,'.svn') &... 0032 ~strcmp(dirname,'CVS') & ... 0033 ~strncmp(dirname,'@',1)& ... %Method directories not allowed in MATLAB path 0034 ~strcmp(dirname,'private') %private directories not allowed in MATLAB path 0035 0036 p = [p genpath_ice(fullfile(d,dirname))]; 0037 end 0038 end