Use library functions by a short name

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.


use(L, <Alias>, f1, f2, …)
use(L, <Alias>)


use(L, f) 'exports' the public function L::f of the library L to the global namespace such that it can be accessed as f without the prefix L.

use(L) exports all public functions of the library L.

The standard way of accessing the function f from the library L is via L::f. When the function f is exported, you can call it simply as f. Technically, exporting means that the global identifier f is assigned the value L::f. Alternatively, when the option Alias is used, an alias is created.

Undoing the export of the library function f means that the value of the global identifier f is deleted. Afterwards, the library function is available only as L::f.

use(L, f1, f2, ...) exports the specified functions f1, f2, ... of the library L. If one of the identifiers already has a value, the corresponding function is not exported. Instead, use prints a warning.

If one of the identifiers is not the name of a public library function, use throws an error.

A function that is already exported cannot be exported the second time.

use evaluates its first argument L, but it does not evaluate the remaining arguments f1, f2, ....

The info function displays the interface functions and the exported functions of a library.

Some libraries have functions that are always exported. You cannot undo the export for these functions. The function append from the library listlib is such an example.

Environment Interactions

When a function is exported, it is assigned to the corresponding global identifier. When you undo the export, the corresponding identifier is deleted.


Example 1

Export the function invphi of the library numlib, and then undo the export:


use(numlib, invphi):

unuse(numlib, invphi):

Export all functions of the library numlib:

Warning: Identifier 'divisors' is not exported because it already has a value. [use]
Warning: Identifier 'contfrac' is not exported because it already has a value. [use]

Here, use issues warnings because contfrac and divisors are already available as global functions. For example, there is the global contfrac function that uses numlib::contfrac for numerical arguments. Undo the export of the numlib functions.


Example 2

use issues a warning if a function cannot be exported since the corresponding identifier already has a value:

invphi := 17:
use(numlib, invphi)
Warning: Identifier 'invphi' is not exported because it already has a value. [use]



The library: a domain

f1, f2, …

Public functions of L: identifiers



Use alias(f = L::f) to create an alias f for L::f rather than exporting L::f by the assignment f:= L::f.

Return Values

Void object null() of type DOM_NULL.


The names of the functions of a library L are stored in the set L::interface. This set is used by the function info and for exporting.

The names of functions exported from a library L are stored in the set L::_exported.