Home > wafo > initwafo.m

initwafo

PURPOSE ^

Initiation of WAFO Toolbox.

SYNOPSIS ^

initwafo(opt,add,first)

DESCRIPTION ^

 INITWAFO   Initiation of WAFO Toolbox.
    WAFO = "Wave Analysis for Fatigue and Oceanography"
 
  CALL:  initwafo(opt,add,first)
 
  Set MATLAB-paths to WAFO toolbox.
 
  The following options may be used.
    opt   = 'minimum' : Minimum initiation, only paths to the 
                        necessary m-files are added.
            'normal'  : Normal initiation, also paths to demos, data and
                        documentation are added. (default)
            'full'    : Full initiation, all paths are added.
    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
    
  Example:
    initwafo;             % Initiate WAFO toolbox paths
    initwafo([],0);       % Remove WAFO toolbox paths
    initwafo('full',1,0); % Full init., put WAFO paths last in search path
 
  See also  wafopath, waforoot, wafoexepath.

CROSS-REFERENCE INFORMATION ^

This function calls: This function is called by:

SOURCE CODE ^

001 function initwafo(opt,add,first)
002 %INITWAFO   Initiation of WAFO Toolbox.
003 %   WAFO = "Wave Analysis for Fatigue and Oceanography"
004 %
005 % CALL:  initwafo(opt,add,first)
006 %
007 % Set MATLAB-paths to WAFO toolbox.
008 %
009 % The following options may be used.
010 %   opt   = 'minimum' : Minimum initiation, only paths to the 
011 %                       necessary m-files are added.
012 %           'normal'  : Normal initiation, also paths to demos, data and
013 %                       documentation are added. (default)
014 %           'full'    : Full initiation, all paths are added.
015 %   add   = 1 : Add paths from MATLAB search path (default)
016 %           0 : Remove paths from MATLAB search path
017 %   first = 1 : Add the paths first in the search path (default)
018 %           0 : Add the paths last in the search path
019 %   
020 % Example:
021 %   initwafo;             % Initiate WAFO toolbox paths
022 %   initwafo([],0);       % Remove WAFO toolbox paths
023 %   initwafo('full',1,0); % Full init., put WAFO paths last in search path
024 %
025 % See also  wafopath, waforoot, wafoexepath.
026 
027 % Tested on: Matlab 5.3
028 % History:
029 % Revised jr 01.01.30
030 %   Changed 'initiation' to 'removal' (line 108)
031 % Revised jr 00.05.23
032 %   Changed demos to wdemos
033 % Updated by PJ 25-Feb-2000
034 %   Removed input option: opt='root'
035 %   Now keeps WAFO root-directory in search path when removing WAFO paths.
036 % Revised pab feb 2000
037 %   Enabled several subdirectories in the papers directory
038 % Updated by PJ 19-Jan-2000
039 %   Now you need to set the path to WAFO root directory 
040 %   before using initwafo.
041 % by Pär Johannesson 29-Sep-1999
042 %   new routine 
043 
044 % Check input and output
045 ni = nargin;
046 no = nargout;
047 error(nargchk(0,3,ni));
048 
049 if ni == 0, opt = []; end
050 if ni<2, add = []; end
051 if ni<3, first = []; end
052 
053 % Set default value
054 if isempty(opt)
055   opt = 'normal';
056 end
057 
058 if isempty(add)
059   add = 1;
060 end
061 
062 if isempty(first)
063   first=1;
064 end
065 
066 % Add root-path to WAFO toolbox
067 wafop = waforoot;
068 
069 path(wafop,path); % Add WAFO path first in search path
070 
071 opt = lower(opt);  % To lower case
072 optNr = 1*strcmp(opt,'minimum') + 2*strcmp(opt,'normal') + ...
073     3*strcmp(opt,'full');
074 
075 p = {wafop};
076 if optNr >= 1 % Add paths to WAFO routines
077   p1 = wafopath('tools');
078   p(end+1:end+length(p1),1) = p1;
079 end
080 if optNr >= 2 % Add paths to WAFO demos, data and documentation
081   p(end+1,1) = wafopath('docs'); 
082   p(end+1,1) = wafopath('wdemos'); 
083   p(end+1,1) = wafopath('data');
084 end
085 if optNr >= 3 % Add paths to WAFO papers
086   tmp = wafopath('papers');
087   Np = length(tmp(:,1));
088   for ix=1:Np,
089     p(end+1,1) = tmp(ix,:);
090   end
091 end
092     
093 if add % Add paths
094   
095   rmpath(wafop) 
096   if first % Add WAFO paths first in search path
097     p(end+1) = {'-begin'};
098    else % Add WAFO paths last in search path (first == 0)
099     p(end+1) = {'-end'};
100   end
101   addpath(p{:});
102   disp(['WAFO toolbox paths set: ' opt ' initiation']);
103   
104 else % Remove paths (add == 0) 
105 
106   % Remove all paths ecxept the path to wafo root-directory
107   rmpath(p{2:end});
108   disp(['WAFO toolbox paths removed: ' opt ' removal']);
109   
110 end
111

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