This is machine translation

Translated by Microsoft
Mouseover text to see original. Click the button below to return to the English verison of the page.

Note: This page has been translated by MathWorks. Please click here
To view all translated materals including this page, select Japan from the country navigator on the bottom of this page.


Check number of input arguments

iptchecknargin will be removed in a future release. Use narginchk instead.


iptchecknargin(low, high, num_inputs, func_name)


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 specifies the name used in the formatted error message to identify the function checking the handle.


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)

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


Introduced before R2006a

Was this topic helpful?