MATLAB Programming/Handle/What is a handle?

From Wikibooks, open books for an open world
Jump to navigation Jump to search

A function handle is a MATLAB data type that represents a function. A typical use of function handles is to pass a function to another function.

For example, you can use function handles as input arguments to functions that evaluate mathematical expressions over a range of values. Other typical uses of function handles include:

(a) Specifying callback functions (for example, a callback that responds to a UI event or interacts with data acquisition hardware).

(b) Constructing handles to functions defined inline instead of stored in a program file (anonymous functions).

(c) Passing a function to another function (often called function functions). For example, passing a function to integration functions, such as integral.

(d) Calling local functions from outside the main function.

References[edit | edit source]

https://blogs.mathworks.com/loren/2006/11/17/some-ways-to-create-function-handles/?doing_wp_cron=1664291465.1865129470825195312500