将 Python 代码集成到 Simulink 中
将具有 Python® 代码的算法集成到 Simulink® 中
Simulink 允许您实现使用 Python 代码设计的算法。您可以使用 MATLAB Function 模块、MATLAB System 模块或 Python 导入器在 Simulink 中实现 Python 模块。对于简单算法的实现,请使用 MATLAB Function 模块。对于需要处理状态动态、流化数据和其他模块自定义的算法,请使用 MATLAB System 模块。Python 导入器使您能够通过为指定函数生成自定义模块,将 Python 模块导入 Simulink 中。
有关在 MATLAB® 中使用 Python 的详细信息,请参阅从 MATLAB 中调用 Python。
主题
- Overview of Integrating Python Code with Simulink
Integrate Python code with Simulink Using MATLAB Function block or MATLAB System block.
- Import Python Code to Simulink Using Python Importer Wizard
Use the Python Importer to Import Python Modules and Packages to Simulink.