Navigation

Operators and Keywords

Function List:

C++ API

: feval (name, …)

Evaluate the function named name.

Any arguments after the first are passed as inputs to the named function. For example,

feval ("acos", -1)
    ⇒ 3.1416

calls the function acos with the argument ‘-1’.

The function feval can also be used with function handles of any sort (see ‘Function Handles’). Historically, feval was the only way to call user-supplied functions in strings, but function handles are now preferred due to the cleaner syntax they offer. For example,

f = @exp;
feval (f, 1)
   ⇒ 2.7183
f (1)
   ⇒ 2.7183

are equivalent ways to call the function referred to by f. If it cannot be predicted beforehand whether f is a function handle, function name in a string, or inline function then feval can be used instead.

Package: octave