I separately wrote the following function
function [func] = fwet_1(~)
func = @(gm1,Sc,Scmax) (Sc/Scmax)^gm1;
end
and when I to run fwet_1(0.23,1,3)
it returns
Error using fwet_1
Too many input arguments.
any idea?
fwet_1
takes a single input, which must be ignored by the function. Your syntax is calling fwet_1
itself with three inputs, not the function handle it returns.
You can call the function handle like this (literally any single argument is allowed in place of []
):
x = fwet_1([])
x(0.23,1,3)
If your function really does nothing but return a function handle, skip the function entirely, or remove the unnecessary level of nesting. Eg:
function [val] = fwet_1(gm1,Sc,Scmax)
val = (Sc/Scmax)^gm1;
end
If you need a function handle, just use @fwet_1
. There's no difference between a regular function and an anonymous one when you pass it around.
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.