what is the meaning of @ in matlab code?

125 Ansichten (letzte 30 Tage)
Kobi
Kobi am 23 Apr. 2019
Beantwortet: Satish Shenkar am 14 Mär. 2021
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 @?
  2 Kommentare
Kobi Aflalo
Kobi Aflalo am 23 Apr. 2019
The link you sent is a general documentation Where is the explanation

Melden Sie sich an, um zu kommentieren.

Akzeptierte Antwort

Girish babu P
Girish babu P am 22 Aug. 2019
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 Kommentare
Girish babu P
Girish babu P am 26 Aug. 2019
Bearbeitet: Guillaume am 26 Aug. 2019
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 am 26 Aug. 2019
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 @)

Melden Sie sich an, um zu kommentieren.

Weitere Antworten (1)

Satish Shenkar
Satish Shenkar am 14 Mär. 2021
how to matrix multiplication

Kategorien

Mehr zu Function Creation finden Sie in Help Center und File Exchange

Produkte


Version

R2018a

Community Treasure Hunt

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

Start Hunting!

Translated by