nargout
Returns the number of outputs.
Syntax
R = nargout
Syntax
R = nargout(function)
Inputs
- function
- The function to be queried for the number of outputs. For a function that can return different numbers of outputs, the result will be the negative of the first optional ouput.
Outputs
- R
- The number of outputs.
Examples
function [x,y] = myfunc(a)
x = nargout;
y = a;
end
[a,b] = myfunc(3)
a = 2
b = 3
R = nargout('sin')
R = 1