Excel to Simulink real time data streaming
3 views (last 30 days)
Show older comments
I need help on how I can stream data of temperature, energy consumption in Excel file into Simulink on real time. This means as you change or enter new value in excel sheet while the Simulink simulation is running, it will be captured as input in Simulink. Thanks in Advance.
0 Comments
Accepted Answer
Walter Roberson
on 1 Jun 2025
Edited: Walter Roberson
on 1 Jun 2025
In the form you have phrased the question, it must be assumed that a random location inside the data might be updated (as opposed to the case where more data is added at the end.)
As such, we need to understand the excel data as being a data matrix, as opposed to it being timeseries data. Timeseries data would involve processing rows of input data at the time associated with the row, with it not being possible to go back and re-do steps if the data changes for an already-processed time.
You cannot use From Spreadsheet for this purpose. From Spreadsheet is strictly for reading matrix data in timeseries form (that is, there is a time column that indicates when each row is to come into effect.)
I am not sure that there are methods to periodically re-read excel data matrices as pure blocks of data; I cannot think of any at the moment, but I might be overlooking something.
The situation would be different if you are willing to run the simulation under the control of MATLAB, and if all of the simulation is to be done each time. In that situation, you would have the MATLAB level re-read from the excel file, and have the MATLAB level perform set_param() calls to set up block parameters, and then call sim() to run all of the simulation, and then loop back.
2 Comments
Walter Roberson
on 5 Jun 2025
You are not clear as to whether the excel data represents time-series data or represents a data matrix.
If it represents time-series data, then there is definitely no method that would permit altering data for times that have already been processed.
If it represents a data matrix, then I cannot currently think of any way to stream it into Simulink, but I might have overlooked something.
More Answers (0)
See Also
Categories
Find more on Data Import from MATLAB 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!