- Install MATLAB Engine API for Python.
- 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.
- Get Started with MATLAB Engine API for Python: https://www.mathworks.com/help/matlab/matlab_external/get-started-with-matlab-engine-for-python.html
- MATLAB Function Block: https://www.mathworks.com/help/simulink/slref/matlabfunction.html
- Call Python from MATLAB: https://www.mathworks.com/help/matlab/call-python-libraries.html