Create a platform dependent path name

MuPAD® notebooks will be removed in a future release. Use MATLAB® live scripts instead.

MATLAB live scripts support most MuPAD functionality, though there are some differences. For more information, see Convert MuPAD Notebooks to MATLAB Live Scripts.


pathname(dir, subdir, …)
pathname(<Root>, dir, subdir, …)


pathname(dir, subdir, ...) returns a relative path name valid on the used operating system.

pathname is used to specify pathnames via MuPAD® strings. Directories and subdirectories are concatenated in a suitable way creating a valid pathname for the currently used operating system. For example, this mechanism may be used to specify the location of library files independent of the platform.

In order to create valid path names for the operating systems supported by MuPAD, the conventions holding for the corresponding operating system must be complied with. In particular, the names must not contain the characters “/” , “\” or “:”. Compliance with these conventions is tested by pathname.

Under Microsoft® Windows®, pathname does not allow to specify a volume to become part of the path name. Names are always relative to the current volume.


pathname("lib", "linalg")

UNIX® (Linux®/ Mac OS X)


Microsoft Windows

pathname(Root, "lib", "linalg")

UNIX (Linux/Mac OS X)


Microsoft Windows



Example 1

The following examples are created on a UNIX/Linux system:

pathname("lib", "linalg")

pathname(Root, "lib", "linalg") . ""


dir, subdir, …

Names of directories: character strings



Makes pathname generate an absolute path name

Return Values