Main Content

エラー処理

関数 mexErrMsgIdAndTxt はエラー情報を出力し、バイナリ MEX ファイルを終了します。たとえば、matlabroot/extern/examples/mx/mxcreatecellmatrixf.F にある次のコードを参照してください。

C     Check for proper number of input and output arguments    
      if (nrhs .lt. 1) then
         call mexErrMsgIdAndTxt( 'MATLAB:mxcreatecellmatrixf:minrhs',
     +    'One input argument required.')
      end if

関数 mexWarnMsgIdAndTxt は情報を出力しますが、MEX ファイルを終了することはありません。たとえば、matlabroot/extern/examples/mx/mxgetepsf.F にある次のコードを参照してください。

C     Check for equality within eps 
      do 20 j=1,elements
    	 if ((abs(first(j) - second(j))).gt.(abs(second(j)*eps))) then
	      call mexWarnMsgIdAndTxt(
     +     'MATLAB:mxgetepsf:NotEqual',
     +     'Inputs are not the same within eps.')
    	    go to 21
	     end if
   20 continue

参考

|

関連するトピック