Documentation

This is machine translation

Translated by Microsoft
Mouseover text to see original. Click the button below to return to the English verison of the page.

Note: This page has been translated by MathWorks. Please click here
To view all translated materals including this page, select Japan from the country navigator on the bottom of this page.

WRITEPATH

Search path for the command ‘ Write ’ et al.

MuPAD® notebooks are not recommended. 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.

Description

Possible values: String or a sequence of strings.

WRITEPATH determines the directory, into which the functions fopen, fprint, write, and protocol write files which are not specified with a full (absolute) pathname. If WRITEPATH is not defined, then the files are written into the “working directory”.

Note that the “working directory” depends on the operating system. On Windows® systems, it is the folder where MuPAD® is installed. On UNIX® or Linux® systems, the “working directory” is the directory where MuPAD was started.

Note

When concatenated with a file name, the directories given by the path variables must produce valid path names.

Path names are slightly system dependent. You can separate subdirectories with a / on all systems. On Windows systems, you may alternatively use a backslash character (\).

Note that in MuPAD, a single backslash inside a character string is created by typing two backslashes. E.g., the MuPAD string representing the path "math\lib\" must be defined by "math\\lib\\".

The function pathname allows to create path names independent of the current operating system.

Examples

Example 1

This example shows how to define a READPATH. More than one path may be given. read will look for files to be opened in the directories given by READPATH. The following produces a valid READPATH for UNIX and Linux systems only, since the path separators are hard coded in the strings:

READPATH := "math/lib/", "math/local/"

It is good programming style to use platform independent path strings. This can be achieved with the function pathname:

READPATH := pathname("math", "lib"), 
            pathname("math", "local")

All path variables can be set to their default values by deleting them:

delete READPATH:

Example 2

The path variable WRITEPATH only accepts one path string:

WRITEPATH := "math/lib/", "math/local/"
Error: Invalid argument. [WRITEPATH]
Was this topic helpful?