Check the number of arguments to a function
Versión 1.0.0.0 (1,31 KB) por
Richie Cotton
Prettify checking the number of arguments to a function.
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);
Citar como
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. Recuperado .
Compatibilidad con la versión de MATLAB
Se creó con
R2010a
Compatible con cualquier versión
Compatibilidad con las plataformas
Windows macOS LinuxCategorías
Más información sobre Argument Definitions en Help Center y MATLAB Answers.
Etiquetas
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!Descubra Live Editor
Cree scripts con código, salida y texto formateado en un documento ejecutable.
Versión | Publicado | Notas de la versión | |
---|---|---|---|
1.0.0.0 |