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.

ssSetErrorStatus

Report an error

Syntax

void ssSetErrorStatus(SimStruct *S, const char_T *msg)

Arguments

S

SimStruct representing an S-Function block or a Simulink® model.

msg

Error message.

Description

Use this function to report errors that occur in your S-function. For example:

ssSetErrorStatus(S, "error message");
return;

    Note   The error message character vector must be in persistent memory; it cannot be a local variable. If you use sprintf to format the error message, you must allocate memory for the message. For example:

    static char msg[35];
    sprintf(msg,"Expected number of parameters: %d",ssGetNumSFcnParams(S));
    ssSetErrorStatus(S,msg);
    

This function causes the Simulink engine to stop and display the specified error message. The function does not generate an exception. Thus you can use it in your S-function to avoid creating exceptions when reporting errors.

Languages

C, C++

Example

See the S-function stvctf.c used in sfcndemo_stvctf.

See Also

ssWarning

Introduced before R2006a

Was this topic helpful?