File Exchange

image thumbnail

Check the number of arguments to a function

version 1.0 (1.31 KB) by

Prettify checking the number of arguments to a function.

0 Downloads

Updated

View License

nargchk is used almost exclusively in one way:

error(nargchk(minargs, maxargs, nargin, 'struct'));

The third and fourth arguments are always the same, and you always wrap it in an error call.

This stupidly simple function saves you typing, and prettifies your code by wrapping the above line into something more readable, namely

CheckNumberArgs(minargs, maxargs);

Comments and Ratings (0)

MATLAB Release
MATLAB 7.10 (R2010a)
Tags Add Tags

Download apps, toolboxes, and other File Exchange content using Add-On Explorer in MATLAB.

» Watch video

Win prizes and improve your MATLAB skills

Play today