Main Content

User Messages

To print text in the MATLAB® Command Window, use the mexPrintf function. To print error and warning information in the Command Window, use the mexErrMsgIdAndTxt and mexWarnMsgIdAndTxt functions.

For example, the following code snippet displays an error message.

      parameter(maxbuf = 100)
      character*100 input_buf

      if (status = mxGetString(prhs(1), input_buf, maxbuf) .ne. 0) then 
         call mexErrMsgIdAndTxt ('MATLAB:myfunc:readError',
     +                           'Error reading string.')

See Also

| |