Code covered by the BSD License  

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

» Watch video

Highlights from
Check the number of arguments to a function

Be the first to rate this file! 1 Download (last 30 days) File Size: 1.31 KB File ID: #27061 Version: 1.0

Check the number of arguments to a function

by

Richie Cotton (view profile)

 

Prettify checking the number of arguments to a function.

| Watch this File

File Information
Description

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);

MATLAB release MATLAB 7.10 (R2010a)
Tags for This File   Please login to tag files.
Please login to add a comment or rating.

Contact us