Code Generation for Custom Blocks - MATLAB & Simulink (original) (raw)

Use S-functions to define code generation behavior for custom blocks

An S-function is a computer language description of a SimulinkĀ® block written in MATLABĀ®, C, C++, or Fortran. You can develop an S-function to represent external code using a programming interface that interacts with the Simulink engine. Use this S-function with the code generator to produce code. Start with S-Functions and Code Generation.

For simpler alternative approaches for interfacing between generated and external code, see External Code Import.

Blocks

Generated S-Function Represent model or subsystem as generated S-function code

Topics

Write S-Functions

Legacy Code Tool

Integrate External C Functions That Pass Input and Output Arguments as Parameters with a Fixed-Point Data Type

Integrate External C Functions That Pass Input and Output Arguments as Parameters with a Fixed-Point Data Type

Integrate legacy C functions that pass their inputs and outputs by using parameters of a fixed-point data type with the Legacy Code Tool.

Integrate External C Functions That Implement N-Dimensional Table Lookups

Integrate External C Functions That Implement N-Dimensional Table Lookups

Integrate legacy C functions that implement N-dimensional table lookups by using the Legacy Code Tool.

Integrate External C++ Object Methods

Integrate External C++ Object Methods

Integrate legacy C++ object methods by using the Legacy Code Tool.