Get variable from MuPAD notebook
MuPAD® notebooks will be removed in a future release. Use MATLAB® live scripts instead.
To convert a MuPAD notebook file to a MATLAB live script file, see
convertMuPADNotebook. MATLAB live scripts support most MuPAD functionality, although there are some differences. For more information, see
Convert MuPAD Notebooks to MATLAB Live Scripts.
MATLABvar = getVar(nb,'MuPADvar')
Copy a variable with a value assigned to it from a MuPAD notebook to the MATLAB workspace.
Create a new MuPAD notebook and specify a handle
mpnb = mupad;
In the MuPAD notebook, enter the following command. This
command creates the variable
f and assigns the
x^2 to this variable. At this point, the
variable and its value exist only in MuPAD.
f := x^2
Return to the MATLAB Command Window and use the
f = getVar(mpnb,'f')
f = x^2
After you call
getVar, the variable
in the MATLAB workspace. The value of the variable
the MATLAB workspace is
getVar to copy variables
the same notebook. Although you do not specify these variables explicitly,
and they do not have any values assigned to them, they exist in MuPAD.
a = getVar(mpnb,'a') b = getVar(mpnb,'b')
a = a b = b
nb— Pointer to MuPAD notebook
Pointer to a MuPAD notebook, specified as a MuPAD notebook
handle. You create the notebook handle when opening a notebook with
MuPADvar— Variable in MuPAD notebook
Variable in a MuPAD notebook, specified as a variable. A variable exists in MuPAD even if it has no value assigned to it.
MATLABvar— Variable in MATLAB workspace
Variable in the MATLAB workspace, returned as a symbolic variable.