nargoutchk
Check for correct number of outputs.
Syntax
nargoutchk(a,b)
Inputs
- a
- Minimum number arguments.
- b
- Maximum number arguments.
Example
Simple nargoutchk example:
function [x,y] = myfunc(a,b)
nargoutchk(1,2)
x = a+b;
y = a-b;
end
try
myfunc(9, 99)
catch
disp('Not enough outputs')
end
Not enough outputs