DNN training online integrating Simulink in Pyton

1 view (last 30 days)
I need to integrate a Simulink model in Python. Specifically, the goal is to pass some simulink signals to a tensorflow neural network defined in Python and put back the result of the processing to the Simulink model. I need to maintain the project in this way in order to open the possibility of online training of the network. Is this possible?

Answers (1)

Sugandhi
Sugandhi on 10 Sep 2024
Hi Lorenzo,
Yes, integrating a Simulink model with a TensorFlow neural network in Python is possible using MATLAB Engine API for Python and MATLAB Function Block in Simulink. Here are high level steps:
  1. Install MATLAB Engine API for Python.
  2. Create a MATLAB Function Block in Simulink: Use a MATLAB Function block to call a Python script. This block can be used to execute Python code from within Simulink. Python script will be called from the MATLAB Function block. Use the MATLAB Engine API to pass data between MATLAB and Python.
Go through the following MathWorks documentation to gain better understanding:
  1. Get Started with MATLAB Engine API for Python: https://www.mathworks.com/help/matlab/matlab_external/get-started-with-matlab-engine-for-python.html
  2. MATLAB Function Block: https://www.mathworks.com/help/simulink/slref/matlabfunction.html
  3. Call Python from MATLAB: https://www.mathworks.com/help/matlab/call-python-libraries.html

Categories

Find more on Simulink Functions in Help Center and File Exchange

Products


Release

R2024a

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!