Documentation

S-Function Builder

Integrate C or C++ code to create S-functions

Library

User-Defined Functions

Description

The S-function builder integrates new or existing C or C++ code and creates a C MEX S-function from specifications you provide. See构建S-Functions自动for detailed instructions on using the S-Function Builder block to generate an S-function.

Instances of the S-Function Builder block also serve as wrappers for generated S-functions in Simulink®models. When simulating a model containing instances of an S-Function Builder block, Simulink software invokes the generated S-function in order to call your C or C++ code in the instance'smdlStart,mdlOutputs,mdlDerivatives,mdlUpdateandmdlTerminatemethods. To learn how Simulink engine interacts with S-functions, seeSimulink Engine Interaction with C S-Functions.

Note

The S-Function Builder block does not support masking. However, you can mask aSubsystemblock that contains an S-Function Builder block. For more information, seeDynamic Masked Subsystem.

Data Type Support

The S-Function Builder can accept and output complex, 1-D, or 2-D signals and nonvirtual buses. For each of these cases, the signals must have a data type that Simulink supports.

For more information, seeData Types Supported by Simulinkin the Simulink documentation.

Parameters

SeeS-Function Builder Dialog Boxin the online documentation for information on using the S-Function Builder block's parameter dialog box.

Characteristics

Data Types

Double | Single | Boolean | Base Integer | Fixed-Point

Multidimensional Signals

Yes

Variable-Size Signals

No

Code Generation

Yes

Introduced before R2006a

Was this topic helpful?