Home > vbmeg > functions > common > utility > vb_get_basename.m

vb_get_basename

PURPOSE ^

get file base-name by removing 'extension'

SYNOPSIS ^

function basename = vb_get_basename(fname,extension)

DESCRIPTION ^

 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)

CROSS-REFERENCE INFORMATION ^

This function calls: This function is called by:

SOURCE CODE ^

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

Generated on Mon 22-May-2023 06:53:56 by m2html © 2005