Notebook path

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.


The environment variables NOTEBOOKFILE and NOTEBOOKPATH store the absolute file name and the directory name, respectively, of the current notebook in the MuPAD® Notebook as a string.

Possible values: String

The environment variable NOTEBOOKFILE stores the name of the current notebook that is connected to the MuPAD kernel.

The environment variable NOTEBOOKPATH stores the name of the directory where the current notebook is located.

These variables are useful, for example, when reading files that are located relative to the notebook.

Both variables only have a value if the notebook has a name, which is generally the case when an existing notebook has been opened or a new notebook has been saved.

The name given by NOTEBOOKFILE is an absolute file name.

Both variables are read-only and are write-protected. One cannot assign a new value to NOTEBOOKFILE in order to change the name of the notebook.

NOTEBOOKFILE and NOTEBOOKPATH are only defined in the MuPAD Notebook. When using the MuPAD engine from MATLAB®, the two variables are just normal identifiers.


Example 1

In the MuPAD Notebook, you can specify startup commands for a notebook, which are executed when the notebook is connected to a kernel.

In the startup commands. you can use NOTEBOOKPATH to read a source file “” which is stored in the directory of the notebook:


See Also

MuPAD Functions