Learn R Programming

matlab (version 1.0.2)

fileparts: MATLAB fileparts function

Description

Return filename parts.

Usage

fileparts(pathname)

Arguments

pathname
character string representing pathname to be parsed

Value

Returns a list with components:
pathstr
character string representing directory path
name
character string representing base of file name
ext
character string representing file extension
versn
character string representing version. Unused

Details

Determines the path, filename, extension, and version for the specified file. The returned ext contains a dot (.) before the file extension. The returned versn is always an empty string as the field is provided for compatibility with its namesake's results.

See Also

fullfile

Examples

Run this code
## Rename dot-txt file as dot-csv
ans <- fileparts("/home/luser/foo.txt")
fullfile(ans$pathstr, paste(ans$name, "csv", sep="."))   # /home/luser/foo.csv

Run the code above in your browser using DataLab