Check the number of arguments to a function

Prettify checking the number of arguments to a function.
356 download
Aggiornato 23 mar 2010

Visualizza la licenza

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

Cita come

Richie Cotton (2024). Check the number of arguments to a function (https://www.mathworks.com/matlabcentral/fileexchange/27061-check-the-number-of-arguments-to-a-function), MATLAB Central File Exchange. Recuperato .

Compatibilità della release di MATLAB
Creato con R2010a
Compatibile con qualsiasi release
Compatibilità della piattaforma
Windows macOS Linux
Categorie
Scopri di più su Argument Definitions in Help Center e MATLAB Answers

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!
Versione Pubblicato Note della release
1.0.0.0