What does "@" do ?
1,655 views (last 30 days)
So this is a simple question. I found some code that uses "@" and I looked it up in the matlab documentation, but I did not find it to be really helpfull. Can somebody explain to me what it does and when/how I want to use it ?
Vandana Rajan on 16 Jan 2017
You might have seen function handles.
A function handle is a MATLABÂ® data type that stores an association to a function.
To create a handle for a function, precede the function name with an @ sign. For example, if you have a function called myfunction, create a handle named f as follows:
>> f = @myfunction;
Now if you have a function like
function y = computeSquare(x)
y = x.^2;
>> f = @ComputerSquare;
>> a = 4;
>> b = f(a)
b = 16
Please go through these 2 documentation links which very clearly explains about function handles.
Yet another use of the symbol '@' is as class folder designator. An @ sign can indicate the name of a class folder, such as
See the below link for more info.