Abstract Data Types Library

    Note:   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?