ssGetCallSystemNumFcnCallDestinations

Get the number of function-call destinations.

Syntax

int_T ssGetCallSystemNumFcnCallDestinations(SimStruct *S, int_T elemIdx)

Arguments

S

SimStruct that represents an S-Function block

elemIdx

The zero-based element index that is output on the first output port.

Returns

int_T

Description

Use to determine the number of function-call destinations when a function-call signal is split by a Function-Call Split block.

Languages

C, C++

Example

In this example model, a user-defined S-function block outputs a function-call signal on its first port and queries the number of function-call destinations via its second output port and a call to ssGetCallSustemNumFcnCallDestinations(S, 0). The signal is split by a Function-Call Split block and then calls two function-call destinations: f and h. Output port Out3 correctly outputs 2.

static void mdlOutputs(SimStruct *S, int_T tid) {
    /* 
     * The second output port outputs the number of blocks 
     * being called to Out3
     */
    real_T *y     = ssGetOutputPortRealSignal(S, 1);
    int_T   numFC = ssGetCallSystemNumFcnCallDestinations(S, 0);
    y[0] = (real_T)numFC;
    UNUSED_PARAMETER(tid);
    /* The first output (function-call port) makes a function-call */
    if (!ssCallSystem(S,0)) {
        /* Error occurred which will be reported by Simulink */
        /* Not true, Simulink does not report it*/
    }
}
Was this topic helpful?