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.


Specify whether to make the S-function's simulation state visible in the simulation state of the model.


void ssSetSimStateVisibility(S, visibility)



SimStruct representing an S-function block.


Option to specify the visibility of the S-function simulation state. The default is false; the simulation state is hidden.


This function allows you to specify whether or not the simulation state of the S-function is accessible from the simulation state of the model. When this option is set to true, you can access the SimState of this block via the getBlockSimState method of ModelSimState and you can restore any modified values via the setBlockSimState of the ModelSimState.


C, C++


The following example uses this function to specify whether the simulation state of an S-function should be visible in the simulation state of the model. The specification is based upon the second (boolean) parameter value.

static void mdlInitializeSizes(SimStruct* S)
    ssSetNumSFcnParams(S, 2); /* two parameters */
    if (ssGetNumSFcnParams(S) != ssGetSFcnParamsCount(S)) 
    ssSetSFcnParamTunable(S, 0, false);
    ssSetSFcnParamTunable(S, 1, false);

        boolean_T visibility = 0U;
        ssSimStateCompliance setting =
            GetSimSnapParameterSetting(S, &visibility);
        if (ssGetErrorStatus(S)) return;

        ssSetSimStateCompliance(S, setting);
        ssSetSimStateVisibility(S, visibility);

See /toolbox/simulink/simdemos/simfeatures/src sfun_simstate.c for the full source code.

Introduced in R2009a

Was this topic helpful?