Documentation

This is machine translation

Translated by Microsoft
Mouseover text to see original. Click the button below to return to the English verison of the page.

Note: This page has been translated by MathWorks. Please click here
To view all translated materals including this page, select Japan from the country navigator on the bottom of this page.

Error Handling

The mexErrMsgIdAndTxt function prints error information and terminates your binary MEX file. The mexWarnMsgIdAndTxt function prints information, but does not terminate the MEX file.

char *buf;
int buflen;

if (mxIsChar(prhs[0])) {
    if (mxGetString(prhs[0], buf, buflen) == 0) {
        mexPrintf("The input string is:  %s\n", buf);
    }
    else { 
        mexErrMsgIdAndTxt("MyProg:ConvertString",
           "Could not convert string data.");
        // exit MEX file
    } 
}
else {
    mexWarnMsgIdAndTxt("MyProg:InputString",
        "Input should be a string to print properly.");
}

// continue with processing

See Also

|

Was this topic helpful?