feval

Evaluates the specified function with the given input(s).

Syntax

feval(func,A,...)

Inputs

function
Function, user-defined or built in, to be evaluated. Can be either the name of the function (string) or a handle to the function.
Type: char | string
Dimension: string
A
Arguments to be passed to the specified function.
Type: double | integer | char | string | logical | struct | cell
Dimension: scalar | string | vector | matrix

Outputs

R
Result of evaluated function.

Examples

Evaluating a built in function:
R = feval('sqrt',9)
R = 3
Evaluating a user-defined function:
function z=testfunc(x, y)
     z=x+y;
end
feval(@testfunc, 3, 4)
R = 7