How do I check if an input argument is empty in a MEX file in MATLAB 7.10 (R2010a)?
조회 수: 2 (최근 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!