feval

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

Syntax

feval(func,A,...)

Inputs

function
Function, user made 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 made function:
function z=testfunc(x, y)
     z=x+y;
end
feval(@testfunc, 3, 4)
R = 7