nargoutchk

Check for correct number of outputs.

Syntax

nargoutchk(a,b)

Inputs

a
Minimum number arguments.
Type: double | integer
Dimension: scalar
b
Maximum number arguments.
Type: double | integer
Dimension: scalar

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