|MATLAB Function Reference|
[y1,y2,...] = feval(fhandle,x1,...,xn)
evaluates the function handle,
fhandle, using arguments
xn. If the function handle is bound to more than one built-in or M-file, (that is, it represents a set of overloaded functions), then the data type of the arguments
xn, determines which function is dispatched to.
[y1,y2...] = feval(function,x1,...,xn)
function is a quoted string containing the name of a function (usually defined by an M-file), then
feval(function,x1,...,xn) evaluates that function at the given arguments. The
function parameter must be a simple function name; it cannot contain path information.
The preferred means of evaluating a function by reference is to use a function handle. To support backward compatibility, |
The following two statements are equivalent.
The following example passes a function handle,
fhandle, in a call to
fhandle argument is a handle to the
fminbnd function uses
feval to evaluate the function handle that was passed in.
In the next example,
@deblank returns a function handle to variable,
fhandle. Examining the handle using
functions(fhandle) reveals that it is bound to two M-files that implement the
deblank function. The default, s
trfun\ deblank.m, handles most argument types. However, the function is overloaded by a second M-file (in the
@cell subdirectory) to handle cell array arguments as well.
When the function handle is evaluated on a cell array,
feval determines from the argument type that the appropriate function to dispatch to is the one that resides in