function [filename] = getfilename(fullname); % GETFILENAME % % Cuts folder and extension part of string off of file name. % % e.g. the result of >> getfilename('/home/user/foo/thisfile.ext') % is 'thisfile' a = find(fullname=='/'); b = find(fullname=='.'); if (isempty(b)) b = length(fullname)+1; else b = b(end); end if (isempty(a)) a = 0; else a = a(end); end filename = fullname(a+1:b-1);