Reputation: 21
You can do in matlab something like this:
>> fh = @(x) x^2
fh =
@(x)x^2
and then
>> fh(3)
ans =
9
Now I look for a way to create the anonymous function and call it in one line, like this (it does not work):
@(x) x^2 (3) <-- This code does not work!
Is there a way to do it?
Upvotes: 2
Views: 103