MATLAB Function Reference    
function_handle (@)

MATLAB data type that is a handle to a function



@function returns a handle to the specified MATLAB function.

A function handle is a MATLAB data type that captures all the information about a function that MATLAB needs to execute, or evaluate, it. A function handle is typically passed in an argument list to other functions. These other functions then use the handle as a means to call the function for whom the handle was constructed.

Because many MATLAB functions are overloaded, a function handle often maps to a number of code sources (e.g., built-in code, M-files), that implement the function. A function handle stores the context of all of these overloaded sources, or methods, if they are on the MATLAB path at the time the handle is created.

You evaluate a function handle using the MATLAB feval command. If you pass a function handle as an argument into another function, then the receiving function must use feval to evaluate the function. When you evaluate an overloaded function handle, MATLAB selects and executes one of the overloaded methods whose context is stored in the handle.

As a standard MATLAB data type, a function handle can be manipulated and operated on in the same manner as other MATLAB data types.

Function handles enable you to:


The following example creates a function handle for the humps function and assigns it to the variable, fhandle.

Pass the handle to another function in the same way you would pass any argument. This example passes the function handle just created to fminbnd, which then minimizes over the interval [0.3, 1].

See Also
str2func, func2str, functions

 function functions