You can integrate existing C (or C++) functions, such as device drivers, lookup tables, and general functions and interfaces, into Simulink®模型使用遗留代码工具。使用遗留代码工具指定编译所需的S函数,文件和路径的名称以及所生成的S函数的选项。
Use thelegacy_code
function to generate an S-function, compile and link the generated S-function, and create a mask for calling the generated S-function.
Before you can uselegacy_code
, ensure that a C compiler is set up for your MATLAB®installation.
legacy_code |
Use Legacy Code Tool |
Integrate C Functions Using Legacy Code Tool
Use the Legacy Code Tool to generate S-functions automatically from existing C code.
S-Functions Incorporate Legacy C Code
Incorporate legacy C code using a handwritten C MEX S-function, the S-Function Builder, and the Legacy Code Tool.
Integrate C Code by Using the MATLAB Function Block
UseMATLAB Functionblocks to call external C code and control enumeration and bus typedefs.