1 简介
function_handle (@)
Handle used in calling functions indirectly
这是官方的介绍,函数句柄@的作用是间接的调用函数。
2 语法
handle = @functionname
handle = @(arglist)anonymous_function
3 详细介绍
返回值handle是某个指定的matlab函数。
A function handle is a MATLAB value that provides a means of calling a function indirectly. You can pass function handles in calls to other functions (often called function functions). You can also store function handles in data structures for later use (for example, as Handle Graphics callbacks). A function handle is one of the standard MATLAB data types.
函数句柄是一个值,这个值用于让matlab间接调用函数。用户可以通过这个句柄将函数传递给其他函数。此外,还可以将函数句柄进行保存,以便稍后再使用(例如对图像的回调函数进行操控)。函数句柄是MATLAB标准数据类型之一。
At the time you create a function handle, the function you specify must be on the MATLAB path and in the current scope of the code creating the handle. For example, you can create a handle to a subfunction as long as you do so from within the file that defines that subfunction. This condition does not apply when you evaluate the function handle. You can, for example, execute a subfunction from a separate (out-of-scope) file using a function handle. This requires that the handle was created by the subfunction (in-scope).