Documentation

This is machine translation

Translated by Microsoft
Mouse over text to see original. Click the button below to return to the English verison of the page.

我们为许可用户提供了部分翻译好的中文文档。您只需登录便可查阅这些文档

Function Handles

Variables that allow you to invoke a function indirectly

A function handle is a data type that stores an association to a function. For example, you can use a function handle to construct anonymous functions or specify call back functions. Also, you can use a function handle to pass a function to another function, or call local functions from outside the main function.

To get started, see Create Function Handle.

Functions

feval Evaluate function
func2str Construct character vector from function handle
str2func Construct function handle from character vector
localfunctions Function handles to all local functions in MATLAB file
functions Information about function handle

Topics

Create Function Handle

Use a function handle to create an association to a named function or an anonymous function. Then, you can indirectly call the representative function.

Pass Function to Another Function

You can use function handles as input arguments to functions that evaluate mathematical expressions over a range of values, such as integral and fzero.

Parameterizing Functions

This topic explains how to store or access extra parameters for mathematical functions that you pass to functions such as fzero, ode45, or integral.

Call Local Functions Using Function Handles

If a function returns handles to local functions, you can call the local functions outside of the main function. This approach allows you to have multiple, callable functions in a single file.

Compare Function Handles

The result of comparing equality of function handles depends on what the handle represents and when you created it.

Was this topic helpful?