close

Close 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.

Description

example

close(nb) closes the MuPAD notebook with the handle nb. If you modified the notebook, close(nb) brings up a dialog box asking if you want to save the changes.

example

close(nb,'force') closes notebook nb without prompting you to save the changes. If you modified the notebook, close(nb,'force') discards the changes.

This syntax can be helpful when you evaluate MuPAD notebooks by using evaluateMuPADNotebook. When you evaluate a notebook, MuPAD inserts results in the output regions or at least inserts the new input region at the bottom of the notebook, thus modifying the notebook. If you want to close the notebook quickly without saving such changes, use close(nb,'force').

Examples

collapse all

Open and close an existing notebook.

Suppose that your current folder contains a MuPAD notebook named myFile1.mn. Open this notebook keeping its handle in the variable nb1:

nb1 = mupad('myFile1.mn');

Suppose that you finished using this notebook and now want to close it. Enter this command in the MATLAB Command Window. If you have unsaved changes in that notebook, then this command will bring up a dialog box asking if you want to save the changes.

close(nb1)

Use a vector of notebook handles to close several notebooks.

Suppose that your current folder contains MuPAD notebooks named myFile1.mn and myFile2.mn. Open them keeping their handles in variables nb1 and nb2, respectively. Also create a new notebook with the handle nb3:

nb1 = mupad('myFile1.mn')
nb2 = mupad('myFile2.mn')
nb3 = mupad
nb1 = 
myFile1

nb2 = 
myFile2

nb3 = 
Notebook1

Close myFile1.mn and myFile2.mn. If you have unsaved changes in any of these two notebooks, then this command will bring up a dialog box asking if you want to save the changes.

close([nb1, nb2])

Identify and close all currently open MuPAD notebooks.

Get a list of all currently open notebooks:

allNBs = allMuPADNotebooks;

Close all notebooks. If you have unsaved changes in any notebook, then this command will bring up a dialog box asking if you want to save the changes.

close(allNBs)

Identify and close all currently open MuPAD notebooks without saving changes.

Get a list of all currently open notebooks:

allNBs = allMuPADNotebooks;

Close all notebooks using the force flag to suppress the dialog box that offers you to save changes:

close(allNBs,'force')

Input Arguments

collapse all

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

You can get the list of all open notebooks using the allMuPADNotebooks function. close accepts a vector of handles returned by allMuPADNotebooks.

Introduced in R2013b