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.


Get variable from MuPAD notebook


MATLABvar = getVar(nb,'MuPADvar')



MATLABvar = getVar(nb,'MuPADvar') assigns the variable MuPADvar in the MuPAD® notebook nb to a symbolic variable MATLABvar in the MATLAB® workspace.


collapse all

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 to that notebook:

mpnb = mupad;

In the MuPAD notebook, enter the following command. This command creates the variable f and assigns the value 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 getVar function:

f = getVar(mpnb,'f')
f =

After you call getVar, the variable f appears in the MATLAB workspace. The value of the variable f in the MATLAB workspace is x^2.

Now, use getVar to copy variables a and b from 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 =
b =

Input Arguments

collapse all

Pointer to a MuPAD notebook, specified as a MuPAD notebook handle. You create the notebook handle when opening a notebook with the mupad or openmn function.

Variable in a MuPAD notebook, specified as a variable. A variable exists in MuPAD even if it has no value assigned to it.

Output Arguments

collapse all

Variable in the MATLAB workspace, returned as a symbolic variable.

Introduced in R2008b

Was this topic helpful?