builtin

Calls the built-in version of a function, ignoring any overriding file.

Category: Programming > Classes

Syntax

[y1, ..., yN] = builtin(name, x1, ..., xM)

Calls the built-in function name with the given arguments.

Description

When you write your own function with the same name as a built-in, yours takes precedence in calls. Inside it, builtin is the way to reach the original, for example to wrap size with extra checks and then delegate to the standard one.

The number of outputs requested from builtin is passed on to the function.

Input arguments

name
Name of a built-in function, as text.
x1, ..., xM
Arguments passed to that function.

Output arguments

y1, ..., yN
Outputs of the built-in function.

Example

Calling built-ins by name

builtin('sum', [1 2 3])
[m, i] = builtin('max', [4 9 2]);
fprintf('max %d at %d\n', m, i)
builtin('upper', 'abc')
Output
ans = 6
max 9 at 2
ans = 'ABC'

See also

feval exist which func2str