Daniel@0: function [last] = filepartsLast(fname) Daniel@0: % filepartsLast Return the last part of a filename (strip off directory and suffix) Daniel@0: % function filepartsLast(fname) Daniel@0: % Daniel@0: % Examples Daniel@0: % filepartsLast('C:/foo/bar') = 'bar' Daniel@0: % filepartsLast('C:/foo/bar.mat') = 'bar' Daniel@0: % filepartsLast('C:/foo/bar.mat.gz') = 'bar.mat' Daniel@0: % filepartsLast('bar.mat') = 'bar' Daniel@0: Daniel@0: [pathstr,name,ext,versn] = fileparts(fname); Daniel@0: last = name;