MATLAB的iptcheckinput函数详解

函数iptcheckinput()用于检查某个阵列是否满足相应的条件,通常用于对函数的输入阵列是否满足要求进行判定。

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

MATLAB的帮助文档对其描述如下:

iptcheckinput(A,valid_classes,valid_attributes, func_name,var_name,arg_pos) checks the validity of the input array A and issues a formatted error message if the array is invalid.
If the array has valid class and attributes as specified by valid_classes and valid_attributes, then iptcheckinput returns nothing.
If the class or attributes are invalid, then iptcheckinput issues a formatted error message that includes information about the function name (func_name), the variable name (var_name), and the argument position (arg_pos). These values are used only to create the error message, not to check whether the array is valid.

一个简单例子:

A = [ 1 2 3; 4 5 6 ];
B = [ 7 8 9; 10 11 12];
C = cat(3,A,B);
iptcheckinput(C,{'numeric'},{'2d'},'func_name','var_name',2)

由于C是由A和B组成的三维矩阵,并不满足判定条件中“2d”的要求,所以输出错误信息。

Function FUNC_NAME expected its second input, var_name, to be two-dimensional.

上面这句话中的“second”来自于其最后一个参数“2”。

评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

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

抵扣说明:

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

余额充值