basename.m

来自「这是一个用于语音信号处理的工具箱」· M 代码 · 共 32 行

M
32
字号
%
% Function to find out the basename and extension
% example: If a filename is speech.dat
%     then the basename is 'speech'
%     and the extention is 'dat'
% The basename.m file used here differs slightly from that used in the
% other software.  In this case the last line is deleted, i.e.,
% the line bname = lower(bname)is not used here.;
% 
function [ bname, xtent] = basename(s)

len=length(s);
for i=1:len,
	if s(i) == '.';
		break;
	end
end

bname=s(1:i-1);

if exist('i') & i == 1,
	bname='';
	xtent=s(i+1:len);
elseif exist('i') & i == len
	bname=s;
	xtent='';
else
	bname=s(1:i-1);
	xtent=s(i+1:len);
end
%bname=lower(bname);

⌨️ 快捷键说明

复制代码Ctrl + C
搜索代码Ctrl + F
全屏模式F11
增大字号Ctrl + =
减小字号Ctrl + -
显示快捷键?