narginchk
Check for correct number of inputs.
Syntax
narginchk(a,b)
Inputs
- a
- Minimum number of input arguments.
- b
- Maximum number of input arguments.
Example
Simple nargoutchk example.
function [x,y] = myfunc(a,b,varargin)
narginchk(3,4)
x = a+b+varargin{1};
y = a-b;
end
try
myfunc(9)
catch
disp('Not enough inputs')
end
Not enough inputs