Maximal number of elements in the history table

MuPAD® notebooks will be removed in a future release. Use MATLAB® live scripts instead.

MATLAB live scripts support most MuPAD functionality, though there are some differences. For more information, see Convert MuPAD Notebooks to MATLAB Live Scripts.


The environment variable HISTORY determines the maximal number of entries of the history table at interactive level.

Possible values: Nonnegative integer smaller than 231.

The commands that are entered interactively in a MuPAD® session, executed in a procedure, or read from a file, as well as the resulting MuPAD outputs are stored in an internal data structure, the history table. Only the most recent entries are kept in memory.

Entries of the history table can be accessed via history or last.

The default value of HISTORY is 20; HISTORY has this value after starting or resetting the system via reset. Also the command delete HISTORY restores the default value.

Within a procedure, the maximal number of entries in the local history table of the procedure is always 3, independent of the value of HISTORY.


Example 1

In the following example, we set the value of HISTORY to 2. Afterwards, only the two most recent inputs and outputs are stored in the history table at interactive level:

a := 1: b := 2: max(a, b):
history(history() - 1), history(history())

The attempt to access the third last entry in the history table leads to an error:

history(history() - 2)
Error: Invalid argument. [history]

We use delete to restore the default value of HISTORY:


See Also

MuPAD Functions