what is the meaning of @ in matlab code?

59 次查看(过去 30 天)
Hi all,
i just downloaded a matlab function from some website and saw something strange
if ~isa(A, 'function_handle')
AT = @(x) A'*x;
A = @(x) A*x;
end
what is the meaning of @?

采纳的回答

Girish babu P
Girish babu P 2019-8-22
An anonymous function is like an inline function in traditional programming languages, defined within a single MATLAB statement. It consists of a single MATLAB expression and any number of input and output arguments.
You can define an anonymous function right at the MATLAB command line or within a function or script.
This way you can create simple functions without having to create a file for them.
The syntax for creating an anonymous function from an expression is
f = @(arglist)expression
  3 个评论
Girish babu P
Girish babu P 2019-8-26
编辑:Guillaume 2019-8-26
f = @myfunction;
Now if you have a function like
function y = compSqure(x)
y = x.^2;
end
f = @compSqure;
a = 4;
b = f(a)
will give
b = 16
plz gothrough this links.
Guillaume
Guillaume 2019-8-26
I have no idea what point you're trying to make but note that you started talking about anonymous function, your new comment demonstrates function handles which are not the same as anonymous functions (despite both using the symbol @)

请先登录,再进行评论。

更多回答(1 个)

Satish Shenkar
Satish Shenkar 2021-3-14
how to matrix multiplication

类别

Help CenterFile Exchange 中查找有关 Function Creation 的更多信息

产品


版本

R2018a

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!

Translated by