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 slfilepart
Home > sltoolbox > fileio > slfilepart.m

slfilepart

PURPOSE ^

SLFILEPARTS Extracts a specified part of a file path string

SYNOPSIS ^

function s = slfilepart(fp, partname)

DESCRIPTION ^

SLFILEPARTS Extracts a specified part of a file path string

 $ Syntax $
   - s = slfilepart(fp, partname)

 $ Arguments $
   - fp:           the path string
   - partname:     the name of the querying part
   - s:            the string of that part

 $ Description $
   - s = slfilepart(fp, partname) extracts the corresponding part.
     The partname can be either of the following:
       - 'name':   title.ext
       - 'ext':    .ext
       - 'title'   title
       - 'parent'  parent path string
     
 $ History $
   - Created by Dahua Lin, on Aug 12nd, 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_writeprops EDL_WRITEPROPS Writes the property table to XML file
  • edl_writescript EDL_WRITESCRIPT Writes an EDL script
  • slpwcomp_blks SLPWCOMP_BLKS Computes pairwise value matrix

SOURCE CODE ^

0001 function s = slfilepart(fp, partname)
0002 %SLFILEPARTS Extracts a specified part of a file path string
0003 %
0004 % $ Syntax $
0005 %   - s = slfilepart(fp, partname)
0006 %
0007 % $ Arguments $
0008 %   - fp:           the path string
0009 %   - partname:     the name of the querying part
0010 %   - s:            the string of that part
0011 %
0012 % $ Description $
0013 %   - s = slfilepart(fp, partname) extracts the corresponding part.
0014 %     The partname can be either of the following:
0015 %       - 'name':   title.ext
0016 %       - 'ext':    .ext
0017 %       - 'title'   title
0018 %       - 'parent'  parent path string
0019 %
0020 % $ History $
0021 %   - Created by Dahua Lin, on Aug 12nd, 2006
0022 %
0023 
0024 if nargin < 2
0025     raise_lackinput('slfilepart', 2);
0026 end
0027 
0028 [p.parent, p.title, p.ext] = fileparts(fp);
0029 
0030 switch partname
0031     case 'name'
0032         s = [p.title, p.ext];
0033     case 'ext'
0034         s = p.ext;
0035     case 'title'
0036         s = p.title;
0037     case 'parent'
0038         s = p.parent;
0039     otherwise
0040         error('sltoolbox:invalidarg', ...
0041             'Invalid part name for a path: %s', partname);
0042 end

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

Contact us at files@mathworks.com