Check the number of arguments to a function
版本 1.0.0.0 (1.3 KB) 作者:
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);
引用格式
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. 检索时间: .
MATLAB 版本兼容性
创建方式
R2010a
兼容任何版本
平台兼容性
Windows macOS Linux类别
在 Help Center 和 MATLAB Answers 中查找有关 Argument Definitions 的更多信息
标签
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!版本 | 已发布 | 发行说明 | |
---|---|---|---|
1.0.0.0 |