Get parts of file name
To reconstruct a file name from the output of fileparts
,
use strcat
to concatenate the file
name and the extension that begins with a period (.) without a path separator.
Then, use fullfile
to build the file name
with the platform-dependent file separators where necessary. For example,
fullfile(filepath, strcat(name,ext))
.
To specify a folder name only, be sure that the rightmost character in
filename
is a delimiter (/ or \). Otherwise,
fileparts
parses the trailing portion of
filename
as the name of the file and returns it in
name
instead of in filepath
.