MATLAB Function Reference Previous page   Next Page

Return information about function handle



S = functions(funhandle) returns, in MATLAB structure S, the function name, type, filename, and other information for the function handle stored in the variable funhandle.

functions does not operate on nonscalar function handles. Passing a nonscalar function handle to functions results in an error.

This table lists the standard fields of the return structure.

Field Name
Field Description
Function name
Function type (e.g., simple, overloaded)
The file to be executed when the function handle is evaluated with a nonoverloaded data type


Example 1

To obtain information on a function handle for the poly function, type

(The term $matlabroot used in this example stands for the file specification of the directory in which MATLAB software is installed for your system. Your output will display this file specification.)

Access individual fields of the returned structure using dot selection notation:

Example 2

The function get_handles returns function handles for a subfunction and private function in output arguments s and p respectively:

Call get_handles to obtain the two function handles, and then pass each to the functions function. MATLAB returns information in a structure having the fields function, type, file, and parentage. The file field contains the file specification for the subfunction or private function:

Example 3

In this example, the function get_handles_nested.m contains a nested function nestfun. This function has a single output which is a function handle to the nested function:

Call this function to get the handle to the nested function. Use this handle as the input to functions to return the information shown here. Note that the function field of the return structure contains the names of the nested function and the function in which it is nested in the format. Also note that functions returns a workspace field containing the variables that are in context at the time you call this function by its handle:

See Also


Previous page  function_handle (@) funm Next page

© 1994-2005 The MathWorks, Inc.