Main Content

mclGetLastErrorMessage

Last error message from unsuccessful library initialization or MATLAB function call

Synopsis

const char* mclGetLastErrorMessage() 

Description

This function returns a message corresponding to the most recent error encountered during library initialization or MATLAB® function execution. If no error has occurred, the function returns an empty character array.

Example

char *args[] = { "-nodisplay" };
if (!mclInitializeApplication(args, 1))
{
    /* Code here cannot use mclGetLastErrorMessage(), which only
       reports errors after mclInitializeApplication() succeeds. */
    fprintf(stderr, "An error occurred while initializing the application.")
    return -1;
}
if (!libmatrixInitialize())
{
    char * message = "An error occurred while initializing libmatrix";
    char * details = mclGetLastErrorMessage();
    if (details && *details)
    {
        fprintf(stderr, "%s: %s", message, details);
    }
    else
    {
        fprintf(stderr, message);
    }
    return -2;
} 

Version History

Introduced in R2010b