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.

Abstract Data Types Library

MuPAD® notebooks are not recommended. 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.


Use only in the MuPAD Notebook Interface. This functionality does not run in MATLAB.

This library contains MuPAD® implementations of abstract data types.

Every instance of these data types is realized as a MuPAD domain.

The usage of this library is completely different from the rest of the MuPAD library: An object of an adt data type is a domain, so that by using the methods described here, you change the object itself as a side-effect. No assignment is necessary to keep your changes. Compare this to usual MuPAD functions, where you have to always use, for example,

f := fourier(f, x, y)

The data types are implemented completely within the MuPAD programming language. Keeping this in mind, the performance is excellent.


We create an object of the abstract data type “stack” and perform the standard operations.

The stack will be initialized with the characters "a", "b" and "c":

S:= adt::Stack("a", "b", "c")

To handle the stack, it must be assigned to an identifier.

The depth (number of elements) and the top of the stack:

S::depth(), S::top()

Push an element, control the depth and then revert the stack. You can see that S is changed, e.g., when the method "push" is called:

S::depth(), S::top()

The stack is now reverted (although this is not a standard operation for abstract stacks, it comes in handy in many uses). After that, we pop all elements until the stack is empty:

while not S::empty() do
S::depth(), S::top()

Was this topic helpful?