Integrate Python Code into Simulink
Simulink allows you to implement algorithms designed using Python code. You can implement Python modules in Simulink using the MATLAB Function block, MATLAB System block, or Python Importer. For implementation of simple algorithms, use the MATLAB Function block. For algorithms that require handling of state dynamics, streaming data, and additional block customizations, use the MATLAB System block. Python Importer enables you to import Python modules into Simulink by generating custom blocks for specified functions.
For more information on using Python in MATLAB®, see Call Python from MATLAB.
Blocks
Python Code | Integrate native Python code into a Simulink model (Since R2025a) |
Topics
- Overview of Integrating Python Code with Simulink
Integrate Python code with Simulink Using MATLAB Function block or MATLAB System block.
- Integrate Python Code into Simulink Using Python Code Block
Integrate native Python code, define interfaces and block algorithm, and run simulations in Simulink.
- Import Python Code to Simulink Using Python Importer Wizard
Use the Python Importer to Import Python Modules and Packages to Simulink.