what is the meaning of @ in matlab code?

618 views (last 30 days)
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;
what is the meaning of @?

Accepted Answer

Girish babu P
Girish babu P on 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
Guillaume on 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 @)

Sign in to comment.

More Answers (1)

Satish Shenkar
Satish Shenkar on 14 Mar 2021
how to matrix multiplication


Find more on Function Creation in Help Center and File Exchange




Community Treasure Hunt

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

Start Hunting!

Translated by