get file base-name by removing 'extension' if file name do not include 'extension', file name is returned Copyright (C) 2011, ATR All Rights Reserved. License : New BSD License(see VBMEG_LICENSE.txt)
0001 function basename = vb_get_basename(fname,extension) 0002 % get file base-name by removing 'extension' 0003 % if file name do not include 'extension', 0004 % file name is returned 0005 % 0006 % Copyright (C) 2011, ATR All Rights Reserved. 0007 % License : New BSD License(see VBMEG_LICENSE.txt) 0008 0009 % find position of 'extension' 0010 Spos = findstr(fname, extension); 0011 0012 if isempty( Spos ) 0013 basename = fname; 0014 else 0015 basename = fname(1:Spos-1); 0016 end