ssDeclareSimulinkFunction
Declare Simulink function with a given function prototype and scope.
Syntax
void ssDeclareSimulinkFunction(SimStruct *S, char *fcnPrototype, SSSimulinkFunctionPtr fcnPtr, SSSimulinkFunctionVisibility fcnVisibility)
Arguments
- S
- SimStruct that represents an S-Function block. 
- fcnPrototype
- Function prototype of the Simulink® function. 
- fcnPtr
- Pointer to local function. 
- fcnVisibility
- Enumerated type - SSSimulinkFunctionVisibilitywith two permissible values,- SS_SCOPED_VISIBILITYand- SS_GLOBAL_VISIBILITY.
Returns
No return value.
Description
To implement a Simulink function with S-Function API, ssDeclareSimulinkFunction can specify the Simulink function implementation at compile time.
To call a Simulink function outside of the model hierarchy with non-default argument
                specifications, use ssDeclareSimulinkFunction to declare the
                    Simulink function with NULL function pointer before using
                other macros to specify the arguments. Use the ssDeclareFunctionCaller function to declare the function call. See
                    ssDeclareFunctionCaller for an example.
Examples
Example 1
Declare the function timestwoFcn in C. It should be
                    implemented separately. If the function is implemented, you can use
                        ssDeclareSimulinkFunction to declare the Simulink
                    function.
void timestwoFcn(SimStruct *S, int tid, ssFcnCallExecArgs *args); char fcnPrototype[] = "y = timestwo(u)"; ssDeclareSimulinkFunction(S,fcnPrototype,timestwoFcn,SS_GLOBAL_VISIBILITY);
Example 2
Open the sfcndemo_simulinkfunction_getset model using 
open_system('sfcndemo_simulinkfunction_getset');sfcndemo_simulinkfunction_getset is an S-function example
                    that models an object with get and set methods using two scoped Simulink functions.Languages
C, C++
See Also
ssCallSimulinkFunction, ssDeclareFunctionCaller, ssGetSimulinkFunctionInput, ssGetSimulinkFunctionOutput, ssQuerySimulinkFunction, ssSetSimulinkFunctionArgComplexity, ssSetSimulinkFunctionArgDataType, ssSetSimulinkFunctionArgDimensions
Version History
Introduced in R2018a