Code covered by the BSD License  

Highlights from
Statistical Learning Toolbox

from Statistical Learning Toolbox by Dahua Lin
Functions for statistical learning, pattern recognition and computer vision, covering many topics.

Description of sladdpath
Home > sltoolbox > utils > sladdpath.m

sladdpath

PURPOSE ^

SLADDPATH Adds dirpath to precede the filenames

SYNOPSIS ^

function paths = sladdpath(filenames, dirpath)

DESCRIPTION ^

SLADDPATH Adds dirpath to precede the filenames

 $ Syntax $
   - paths = sladdpath(filenames, dirpath)

 $ Arguments $
   - filenames:        the filenames without root path
   - dirpath:          the preceding dirpath to be added
   - paths:            the full names after the dirpath is added

 $ Description $
   - paths = sladdpath(filenames, dirpath) adds directory path in front
     of the filenames to form full paths.

 $ History $
   - Created by Dahua Lin, on Jul 27th, 2006

CROSS-REFERENCE INFORMATION ^

This function calls:
  • raise_lackinput RAISE_LACKINPUT Raises an error indicating lack of input argument
This function is called by:
  • edl_batchexp EDL_BATCHEXP Performs Batch experiments according to scheme
  • edl_go EDL_GO The Top interface for doing experiments in EDL
  • edl_readexpdefs EDL_READEXPDEFS Reads in an experiment definition from XML file
  • edl_readexpdefs_old EDL_READEXPDEFS Reads in experiment definition XML file
  • edl_writescript EDL_WRITESCRIPT Writes an EDL script
  • slpwcomp_blks SLPWCOMP_BLKS Computes pairwise value matrix
  • addfiles ADDFILES add a set of log files to the logger
  • isattached ISATTACHED Judges whether the file is attached to the logger
  • slmkdir SLMKDIR Makes a directory if it does not exist
  • slrmdir SLMKDIR Makes a directory if it does not exist
  • slpartitionpca_apply SLPARTITIONPCA_APPLY applies partition-based PCA to a set of arrays
  • slpartitionpca_construct SLPARTITIONPCA_CONSTRUCT Constructs the array from features

SUBFUNCTIONS ^

SOURCE CODE ^

0001 function paths = sladdpath(filenames, dirpath)
0002 %SLADDPATH Adds dirpath to precede the filenames
0003 %
0004 % $ Syntax $
0005 %   - paths = sladdpath(filenames, dirpath)
0006 %
0007 % $ Arguments $
0008 %   - filenames:        the filenames without root path
0009 %   - dirpath:          the preceding dirpath to be added
0010 %   - paths:            the full names after the dirpath is added
0011 %
0012 % $ Description $
0013 %   - paths = sladdpath(filenames, dirpath) adds directory path in front
0014 %     of the filenames to form full paths.
0015 %
0016 % $ History $
0017 %   - Created by Dahua Lin, on Jul 27th, 2006
0018 %
0019 
0020 %% Parse and verify input arguments
0021 
0022 if nargin < 2
0023     raise_lackinput('sladdpath', 2);
0024 end
0025 
0026 if iscell(filenames)
0027     ismulti = true;
0028 elseif ischar(filenames)
0029     ismulti = false;
0030 else
0031     error('sltoolbox:invalidarg', ...
0032         'The filenames should be either a single char string of the filename or a cell array of strings');
0033 end
0034 
0035 
0036 %% Main skeleton
0037 
0038 if ~ismulti
0039     if ~isempty(dirpath)
0040         paths = internal_addpath(filenames, dirpath);
0041     else
0042         paths = filenames;
0043     end
0044 else
0045     if ~isempty(dirpath)
0046         n = numel(filenames);
0047         paths = cell(size(filenames));
0048         for i = 1 : n
0049             paths{i} = internal_addpath(filenames{i}, dirpath);
0050         end
0051     else
0052         paths = filenames;
0053     end
0054 end
0055 
0056 
0057 %% Sub-functions
0058 
0059 function pathstr = internal_addpath(filename, dirpath)
0060 % precondition: dirpath is not empty
0061 
0062 if dirpath(end) ~= '\'
0063     pathstr = [dirpath, '\', filename];
0064 else
0065     pathstr = [dirpath, filename];
0066 end
0067 
0068 
0069     
0070 
0071 
0072 
0073 
0074 
0075 
0076 
0077 
0078

Generated on Wed 20-Sep-2006 12:43:11 by m2html © 2003

Contact us at files@mathworks.com