Note: MuPAD® notebooks are not recommended. Use MATLAB® live scripts instead.
MATLAB live scripts support most MuPAD functionality, though there are some. For more information, see Convert MuPAD Notebooks to MATLAB Live Scripts.
When you open a saved MuPAD notebook file, the notebook
displays the results (outputs), but the engine does not "remember"
them. For example, suppose that you saved the notebook
your current folder and then opened it:
nb = mupad('myFile1.mn');
myFile1.mn performs these computations.
Open that file and try to use the value
synchronizing the notebook with its engine. The variable
has no assigned value.
To synchronize a MuPAD notebook with its engine, you must evaluate the notebook as follows:
Open the notebooks that you want to evaluate. Symbolic Math Toolbox™ cannot evaluate MuPAD notebooks without opening them.
Alternatively, you can evaluate the notebook by selecting Notebook > Evaluate All from
the main menu of the MuPAD notebook.
Perform your computations using data and results obtained from MuPAD notebooks.
Close the notebooks. This step is optional.
For example, evaluate the notebook
in your current folder:
Now, you can use the data and results from that notebook in
your computations. For example, copy the variables
the MATLAB workspace:
y = getVar(nb,'y') w = getVar(nb,'w')
y = sin(x)/(sin(x)^2 + 1) w = sin(x)/(sin(x)^2 - sin(x) + 1)
You can evaluate several notebooks in a single call by passing
a vector of notebook handles to
nb1 = mupad('myFile1.mn'); nb2 = mupad('myFile2.mn'); evaluateMuPADNotebook([nb1,nb2])
Also, you can use
returns handles to all currently open notebooks. For example, if you
want to evaluate the notebooks with the handles
and no other notebooks are currently open, then enter:
If any calculation in a notebook throws an error, then
The error messages appear in the MATLAB Command Window and in
the MuPAD notebook. When you evaluate several notebooks and one
of them throws an error,
not proceed to the next notebook. It stops and displays an error message
immediately. If you want to skip calculations that cause errors and
evaluate all input regions that run without errors, use