Is this a way to get a reference to a function? For example, if you write like this: @isnumeric
|
1 answer
Yes, this is a link to a function that can be passed as a parameter to another function. For example,
integral(@sin, 0, pi) integrates sine from 0 to pi.
This symbol is also used for anonymous functions, where the definition and getting of the link go at the same time:
f = @(x) 3*sin(x) f(pi/2) % возвращает 3 integral(f, 0, pi) % возвращает 6 |