MATLAB的函数iptchecknargin()有什么用

函数iptchecknargin()用于检查函数输入参数的个数。

执行函数主体代码前,先检查函数的输入参数个数是否满足要求。

ipt是image process tools,即图像处理工具的缩写,MALAB里边有一个图像像处理工具箱,里边有一组函数的命名规则是在前面加上ipt。

nargin是输入参数个数的意思,是number of arguments input的缩写。

在MATLAB的HELP中打开Product Help,然后搜索iptchecknargin,对这个函数的介绍如下:

iptchecknargin(low,high,num_inputs,func_name) checks whether num_inputs is a valid number of input arguments and issues a formatted error message if the number of input arguments is invalid.
If the number of input arguments is in the range [low high], then iptchecknargin returns nothing.
If the number of input argument is less than low or greater than high, then iptchecknargin issues a formatted error message that includes information about the function name (func_name). This value is used only to create the error message, not to check whether the number of input arguments is valid.

Examples

function test_function(varargin)
    iptchecknargin(1,3,nargin,mfilename);
end

这里再搜索nargin,解释如下:

Nargin
Number of function arguments
Syntax
nargin
nargin(fun)
Description
In the body of a function, nargin indicates how many input arguments a user has supplied. ..........

以上英文介绍就不翻译了。

评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值