cleanpath(path_name, working_path)
Removes redundant characters from the file path name, e.g. '//', '/./' as well as initial './' and circular paths e.g. 'abc/def/../def/'.
Additionally, all file separators are set to the platform file separator.
If a working directory path is given (the pwd function can be used to get the current directory), the input path name is assumed to be an absolute path and the working directory path is removed thus returning the relative path.
Cite As
Marco Bucci (2026). cleanpath(path_name, working_path) (https://www.mathworks.com/matlabcentral/fileexchange/59771-cleanpath-path_name-working_path), MATLAB Central File Exchange. Retrieved .
MATLAB Release Compatibility
Platform Compatibility
Windows macOS LinuxCategories
Tags
Discover Live Editor
Create scripts with code, output, and formatted text in a single executable document.
| Version | Published | Release Notes | |
|---|---|---|---|
| 1.2.0.0 | The internal RELATIVEPATH function should now working correctly. I can remove totally as well as partially the working directory path from the absolute path. |
||
| 1.1.0.0 | Bug fixing: the internal relpath function was missed
|
||
| 1.0.0.0 |
