Why does nargout return -1 in this case?
function test
fun=@(a)helper_fun(a,2);
[x,y]=fun(1);
x, % 1
y, % 2
nargout(fun), % -1
end
function [c,d] = helper_fun(a,b)
c=a;
d=b;
end
Is there an alternative to extract the correct number of output variables of fun?
I was hoping to impose a syntax check in a function that takes function_handle as an optional variable and this artifact forced me to either change how my function must look or not check number of outputs.