Quantcast

Documentation Center

  • Trial Software
  • Product Updates

evaluateMuPADNotebook

Evaluate MuPAD notebook

Syntax

  • evaluateMuPADNotebook(nb) example
  • evaluateMuPADNotebook(nb,'IgnoreErrors',true) example

Description

example

evaluateMuPADNotebook(nb) evaluates the MuPAD® notebook with the handle nb and returns logical 1 (true) if evaluation runs without errors. If nb is a vector of notebook handles, then this syntax returns a vector of logical 1s.

example

evaluateMuPADNotebook(nb,'IgnoreErrors',true) does not stop evaluating the notebook when it encounters an error. This syntax skips any input region of a MuPAD notebook that causes errors, and proceeds to the next one. If the evaluation runs without errors, this syntax returns logical 1 (true). Otherwise, it returns logical 0 (false). The error messages appear in the MuPAD notebook only.

By default, evaluateMuPADNotebook uses 'IgnoreErrors',false, and therefore, evaluateMuPADNotebook stops when it encounters an error in a notebook. The error messages appear in the MATLAB® Command Window and in the MuPAD notebook.

Examples

expand all

Evaluate a Particular Notebook

Execute commands in all input regions of a MuPAD notebook. Results of the evaluation appear in the output regions of the 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');

Evaluate all input regions in this notebook. If all calculations run without an error, then evaluateMuPADNotebook returns logical 1 (true):

evaluateMuPADNotebook(nb1)
ans =
     1

Evaluate Several Notebooks

Use a vector of notebook handles to evaluate 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

Evaluate myFile1.mn and myFile2.mn:

evaluateMuPADNotebook([nb1, nb2])
ans =
     1

Evaluate All Open Notebooks

Identify and evaluate all open MuPAD 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

Get a list of all currently open notebooks:

allNBs = allMuPADNotebooks;

Evaluate all notebooks. If all calculations run without an error, then evaluateMuPADNotebook returns an array of logical 1s (true):

evaluateMuPADNotebook(allNBs)
ans =
     1
     1
     1

Evaluate All Open Notebooks Ignoring Errors

Identify and evaluate all open MuPAD notebooks skipping evaluations that cause errors.

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

Get a list of all currently open notebooks:

allNBs = allMuPADNotebooks;

Evaluate all notebooks using 'IgnoreErrors',true to skip any calculations that cause errors. If all calculations run without an error, then evaluateMuPADNotebook returns an array of logical 1s(true):

evaluateMuPADNotebook(allNBs,'IgnoreErrors',true)
ans =
     1
     1
     1

Otherwise, it returns logical 0s for notebooks that cause errors (false):

ans =
     0
     1
     1

Input Arguments

expand all

nb — Pointer to MuPAD notebookhandle to notebook | vector of handles to notebooks

Pointer to MuPAD 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. evaluateMuPADNotebook accepts a vector of handles returned by allMuPADNotebooks.

See Also

| | | | | |

Was this topic helpful?