How do I check if an input argument is empty in a MEX file in MATLAB 7.10 (R2010a)?
1 次查看(过去 30 天)
显示 更早的评论
I would like to check if an input argument is empty in a MEX file. This is similar to using the ISEMPTY function in MATLAB.
采纳的回答
MathWorks Support Team
2010-6-2
The following command can be used to check if an argument is empty by checking if the dimension is zero.
if (mxGetM(prhs[i]) == 0 && mxGetN(prhs[i]) == 0)
mexErrMsgTxt("Empty argument.");
1 个评论
James Tursa
2021-2-5
编辑:James Tursa
2021-2-5
From the mxGetN documentation:
If pm is an N-dimensional mxArray, mxGetN is the product of dimensions 2 through N.
So, the above answer is not wrong for the usage of mxGetN( ). However, it is wrong as you point out for the usage of && ... it should be || instead.
更多回答(0 个)
另请参阅
类别
在 Help Center 和 File Exchange 中查找有关 Call C++ from MATLAB 的更多信息
产品
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!