Skip to Main Content Skip to Search
Product Documentation

iptchecknargin - Check number of input arguments

Syntax

iptchecknargin(low, high, num_inputs, func_name)

Description

iptchecknargin(low, high, num_inputs, func_name) checks whether num_inputs is in the range indicated by low and high. If not, iptchecknargin issues a formatted error message.

low should be a scalar nonnegative integer.

high should be a scalar nonnegative integer or Inf.

func_name is a string that specifies the name used in the formatted error message to identify the function checking the handle.

Examples

Create a function and use iptchecknargin to check that the number of arguments passed to the function is within the expected range.

function test_function(varargin)
iptchecknargin(1,3,nargin,mfilename);

Trigger the error message by executing the function at the MATLAB command line, specifying more than the expected number of arguments.

test_function(1,2,3,4)

See Also

iptcheckhandle | iptcheckinput | iptcheckmap | iptcheckstrs | iptnum2ordinal

  


Recommended Products

Includes the most popular MATLAB recorded presentations with Q&A sessions led by MATLAB experts.

 © 1984-2012- The MathWorks, Inc.    -   Site Help   -   Patents   -   Trademarks   -   Privacy Policy   -   Preventing Piracy   -   RSS