STEM base file name without directory or suffix
s = stem(p) returns the stem (base name) of the file specified by the path p. leading dot filenames are allowed.
Contents
Inputs:
- p: Character vector or string scalar specifying the file path.
Output:
- s: Character vector or string scalar containing the file name without directory or suffix.
Note: fileparts() was about 100x faster then using multiple steps with pattern.
function s = stem(filepath) arguments filepath string end [~, s, e] = fileparts(filepath); i = stdlib.strempty(s); s(i) = e(i); end