MATLAB Function Reference |
Syntax
Description
[pathstr, name, ext, versn] = fileparts('filename')
returns the path, filename, extension, and version for the specified file. The returned ext
field contains a dot (.
) before the file extension.
The fileparts
function is platform dependent.
You can reconstruct the file from the parts using
Examples
This example returns the parts of file
to path
, name
, ext
, and ver
.
file = '\home\user4\matlab\classpath.txt'; [pathstr, name, ext, versn] = fileparts(file) pathstr = \home\user4\matlab name = classpath ext = .txt versn = ''
See Also
File Formats | filesep |
© 1994-2005 The MathWorks, Inc.