This is machine translation

Translated by Microsoft
Mouseover text to see original. Click the button below to return to the English version of the page.

Note: This page has been translated by MathWorks. Click here to see
To view all translated materials including this page, select Country from the country navigator on the bottom of this page.

S-Function Builder

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

  • Library:
  • Simulink / 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 Build S-Functions Automatically 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's mdlStart, mdlOutputs, mdlDerivatives, mdlUpdate and mdlTerminate methods. To learn how Simulink engine interacts with S-functions, see Simulink Engine Interaction with C S-Functions.

Note

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

Ports

Input

expand all

The S-Function Builder can accept and 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, see Data Types Supported by Simulink in the Simulink documentation.

Data Types: single | double | int8 | int16 | int32 | uint8 | uint16 | uint32 | Boolean | fixed point | enumerated | bus

Output

expand all

The S-Function Builder can 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, see Data Types Supported by Simulink in the Simulink documentation.

Data Types: single | double | int8 | int16 | int32 | uint8 | uint16 | uint32 | Boolean | fixed point | enumerated | bus

Parameters

See S-Function Builder Dialog Box in the online documentation for information on using the S-Function Builder block's parameter dialog box.

Block Characteristics

Data Types

double | single | Boolean | base integer | fixed point

Direct Feedthrough

No

Multidimensional Signals

Yes

Variable-Size Signals

No

Zero-Crossing Detection

No

Extended Capabilities

Fixed-Point Conversion
Convert floating-point algorithms to fixed point using Fixed-Point Designer™.

Introduced before R2006a