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.
- A
- Arguments to be passed to the specified function.
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