This is machine translation

Translated by Microsoft
Mouse over text to see original. Click the button below to return to the English verison of the page.

Close MuPAD Notebooks from MATLAB

    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.

To close notebooks from the MATLAB Command Window, use the close function and specify the handle to that notebook. For example, create the notebook with the handle nb:

nb = mupad;

Now, close the notebook:


If you do not have a handle to the notebook (for example, if you created it without specifying a handle or accidentally deleted the handle later), use allMuPADNotebooks to return handles to all currently open notebooks. This function returns a vector of handles. For example, create three notebooks without handles:


Use allMuPADNotebooks to get a vector of handles to these notebooks:

nbhandles = allMuPADNotebooks
nbhandles = 

Close the first notebook (Notebook1):


Close all notebooks:


If you modify a notebook and then try to close it, MuPAD brings up the dialog box asking if you want to save changes. To suppress this dialog box, call close with the 'force' flag. You might want to use this flag if your task requires opening many notebooks, evaluating them, and then closing them. For example, suppose that you want to evaluate the notebooks,, ..., located in your current folder. First, open the notebooks. If you do not have any other notebooks open, you can skip specifying the handles and later use allMuPADNotebooks. Otherwise, do not forget to specify the handles.


Evaluate all notebooks:


When you evaluate MuPAD notebooks, you also modify them. Therefore, when you try to close them, the dialog box asking you to save changes will appear for each notebook. To suppress the dialog box and discard changes, use the 'force' flag:

Was this topic helpful?