use*_*977 2 matlab function-handle
你可以在matlab中做这样的事情:
>> fh = @(x) x^2
fh =
@(x)x^2
Run Code Online (Sandbox Code Playgroud)
然后
>> fh(3)
ans =
9
Run Code Online (Sandbox Code Playgroud)
现在我寻找一种方法来创建匿名函数并在一行中调用它,就像这样(它不起作用):
@(x) x^2 (3) <-- This code does not work!
Run Code Online (Sandbox Code Playgroud)
有办法吗?