Home > functions > common > utility > vb_get_ext_fname.m

vb_get_ext_fname

PURPOSE ^

SYNOPSIS ^

function [fpath, fname] = vb_get_ext_fname(dname,ext,prefix)

DESCRIPTION ^

 Copyright (C) 2011, ATR All Rights Reserved.
 License : New BSD License(see VBMEG_LICENSE.txt)

CROSS-REFERENCE INFORMATION ^

This function calls: This function is called by:

SOURCE CODE ^

0001 function    [fpath, fname] = vb_get_ext_fname(dname,ext,prefix)
0002 %
0003 % Copyright (C) 2011, ATR All Rights Reserved.
0004 % License : New BSD License(see VBMEG_LICENSE.txt)
0005 
0006 if nargin==1, ext = ''; end;
0007 if nargin < 3, prefix = ''; end;
0008 
0009 df = dir([dname '/*' ext]);
0010 
0011 fpath = [];
0012 fname = [];
0013 Nfile = length(df);
0014 nf = 0;
0015 
0016 for n=1:Nfile
0017     if df(n).isdir==0,
0018         fn = df(n).name;
0019         if isempty(prefix) || any(strfind(fn,prefix) == 1),
0020             nf = nf + 1;
0021             fpath{nf} = [dname filesep fn];
0022             if ~isempty(ext),
0023                 fn = fn(1:strfind(fn,ext)-1);
0024             end
0025             fname{nf} = fn;
0026         end
0027     end
0028 end

Generated on Tue 27-Aug-2013 11:46:04 by m2html © 2005