Notebook file name
The environment variables NOTEBOOKFILE and NOTEBOOKPATH store the absolute file name and the directory name, respectively, of the current notebook in the MuPAD® Notebook app 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 app. When using the MuPAD engine from MATLAB®, the two variables are just normal identifiers.
In the MuPAD Notebook app, 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 "my_init.mu" which is stored in the directory of the notebook: