How do i pass data between Matlab and Simulink while Simulink is running ?

6 views (last 30 days)
I would like to pass data from Simulink to a Matlab NN and Pass the outcome of the NN back to Simulink. (Unfortuntly the Pridict function is not supported in Simulink so i won't be able to add the NN in Simulink directly)

Answers (1)

Rahul
Rahul on 17 Mar 2025
In order to pass data from Simulink to a MATLAB based Neural Network and then pass the outcome back to Simulink, consider using 'MATLAB Function Block' inside your Simulink model.
Using the MATLAB Function Block, you can describe your code for running the Neural Network inside it or call the function for where the code might be situated.
The input for this block must be the input to be passed to the Neural Network, and the output of the block will be the network's prediction. Connect the block as required within your Simulink model.
You can also consider using S-Function block or MATLAB System Block for advanced functionality and performance.
The following MathWorks documentations can be referred to know more:
Thanks.

Categories

Find more on Deep Learning Toolbox in Help Center and File Exchange

Community Treasure Hunt

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

Start Hunting!