Excel to Simulink real time data streaming

3 次查看(过去 30 天)
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.

采纳的回答

Walter Roberson
Walter Roberson 2025-6-1
编辑:Walter Roberson 2025-6-1
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 个评论
Nonso
Nonso 2025-6-5
@Walter Roberson,thank you for your time and wonderful contribution. I can stream excel dataset now into Simulink, but the excel file has to be read into the workspace first, before streaming. In this case, I cannot manually enter new values in the excel for the Simulation to update itself as it runs i.e real time update. I need something to tie the excel and the Simulink for real time Simulation update. I want Simulink to accept real time input from excel as it runs basically.
Walter Roberson
Walter Roberson 2025-6-5
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.

请先登录,再进行评论。

更多回答(0 个)

类别

Help CenterFile Exchange 中查找有关 Data Import from MATLAB 的更多信息

Community Treasure Hunt

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

Start Hunting!

Translated by