Home > wafo > wafopath.m

wafopath

PURPOSE ^

Adds or removes WAFO subdirectories from the search path.

SYNOPSIS ^

p = wafopath(part,add,first)

DESCRIPTION ^

  WAFOPATH Adds or removes WAFO subdirectories from the search path.
 
  CALL:  wafopath(part,add,first) 
  
    part  = 'tools'  : All necessary WAFO routines. (default)
            'docs'   : Documentation.
            'wdemos'  : Demos.
            'data'   : Data sets.
            'papers' : Papers.
    add   = 1 : Add paths from MATLAB search path (default)
            0 : Remove paths from MATLAB search path 
    first = 1 : Add the paths first in the search path (default)
            0 : Add the paths last in the search path
 
  See also  initwafo, waforoot, wafoexepath.

CROSS-REFERENCE INFORMATION ^

This function calls: This function is called by:

SOURCE CODE ^

001 function p = wafopath(part,add,first)
002 % WAFOPATH Adds or removes WAFO subdirectories from the search path.
003 %
004 % CALL:  wafopath(part,add,first) 
005 % 
006 %   part  = 'tools'  : All necessary WAFO routines. (default)
007 %           'docs'   : Documentation.
008 %           'wdemos'  : Demos.
009 %           'data'   : Data sets.
010 %           'papers' : Papers.
011 %   add   = 1 : Add paths from MATLAB search path (default)
012 %           0 : Remove paths from MATLAB search path 
013 %   first = 1 : Add the paths first in the search path (default)
014 %           0 : Add the paths last in the search path
015 %
016 % See also  initwafo, waforoot, wafoexepath.
017 
018 %          NOTE: User no longer has to edit this file (since v1.1.14).
019 %          It is now automatic.
020 
021 % Tested on: Matlab 5.3
022 % History:
023 % Revised ny PJ 10-Apr-2001
024 % - Now adds wafo/papers to path, since Contents-file added to PAPERS
025 % revised pab 09.12.2000
026 % - made sure all paths are in lower case letters
027 % revised jr 23.05.2000
028 % - changed demos -> wdemos, sim -> wsim, 
029 % - removed lines related to fplot
030 % revised pab 28.01.2000
031 % - changed 'papers' option: to include the actual directory of the paperscripts
032 % - changed 'tools'  option: only the tools which is actually installed on 
033 %                            the system is added to the matlab path
034 % Changed by Pär Johannesson 12-Jan-2000
035 %   Path 'exec/...' is now first in search path.
036 %   Searches for mex-files first, then m-files.
037 % Changed by Pär Johannesson 28-Sep-1999
038 %   Added input argument 'part'  
039 % by pab 11.08.99
040 %   new routine 
041 
042 % Check input and output
043 ni = nargin;
044 no = nargout;
045 error(nargchk(0,3,ni));
046 
047 % Set default values
048 if ni<1|isempty(part),  part  = 'tools'; end
049 if ni<2|isempty(add),   add   = 1;       end
050 if ni<3|isempty(first), first = 1;       end
051 
052 
053 %pref=[pathsep, waforoot];
054 %p = [waforoot filesep];
055 proot = [waforoot filesep];
056 
057 
058 if strcmp(part,'tools')
059   p = {[proot 'exec' filesep lower(computer)]}; % Search for mex-files first
060                         
061   if 1, % new call 
062     w=dir(proot); inddir=find(cat(1,w.isdir));
063     wdir={w(inddir).name};
064     % remove non-tools directories from dir list
065     wdir(1:2)=[]; % remove '.' and '..' from dir list
066     ind=strmatch('exec',wdir);   wdir(ind)=[];
067     ind=strmatch('docs',wdir);   wdir(ind)=[];
068     ind=strmatch('wdemos',wdir);  wdir(ind)=[];
069     ind=strmatch('papers',wdir); wdir(ind)=[];
070     ind=strmatch('data',wdir);   wdir(ind)=[];
071     ind=strmatch('source',wdir); wdir(ind)=[];
072     N=length(wdir);
073     % adds only those directories which is actually installed on the
074     % current system
075     for ix=1:N
076       p(ix+1,1) = {[proot lower(wdir{ix})]};
077     end
078   else % old call
079     p(end+1,1) = {[proot 'onedim']};
080     p(end+1,1) = {[proot 'multidim']};
081     p(end+1,1) = {[proot 'spec']};
082     p(end+1,1) = {[proot 'trgauss']};
083     p(end+1,1) = {[proot 'wavemodels']};
084     p(end+1,1) = {[proot 'wsim']};
085     p(end+1,1) = {[proot 'wstats']};
086     p(end+1,1) = {[proot 'kdetools']};
087     p(end+1,1) = {[proot 'misc']};
088     p(end+1,1) = {[proot 'cycles']};
089     p(end+1,1) = {[proot 'markov']};
090     %p(end+1,1) = {[proot 'smarkov']};
091     p(end+1,1) = {[proot 'damage']};
092     % p(end+1,1) = {[proot 'fplot']};
093   end
094 elseif strcmp(part,'docs')
095   p = {[proot 'docs']};
096 elseif strcmp(part,'wdemos')
097   p = {[proot 'wdemos']};
098 elseif strcmp(part,'data')
099   p = {[proot 'data']};
100 elseif strcmp(part,'papers')
101   w=dir(fullfile(proot,'papers'));
102   w=w(3:end); % remove '.' and '..' from dir list
103   N=length(w);
104   if N<1
105     disp('No paper scripts are installed')
106   else
107     p = {[proot 'papers']}; % PJ 10-Apr-2001
108     ix=0;
109     iy=1;
110     while ix<N
111       ix=ix+1;
112       if w(ix).isdir
113     iy=iy+1;
114     p(iy,1) = {[proot 'papers' filesep lower(w(ix).name)]};
115       else
116 % Commented by PJ 10-Apr-2001
117 %    disp(['There should be no m-files in:  ' proot 'papers'])
118 %    disp('only directories')
119       end
120     end
121   end
122 end
123 
124 if no == 0
125   if add 
126     if first
127       addpath(p{:},'-begin');
128     else
129       addpath(p{:},'-end');
130     end
131     disp('Pathnames Successfully Set')
132   else
133     rmpath(p{:})
134     disp('Pathnames Successfully Removed')
135   end 
136 end
137   
138

Mathematical Statistics
Centre for Mathematical Sciences
Lund University with Lund Institute of Technology

Comments or corrections to the WAFO group


Generated on Thu 06-Oct-2005 02:21:16 for WAFO by m2html © 2003