Excel to Simulink real time data streaming

3 visualizaciones (últimos 30 días)
Nonso
Nonso el 1 de Jun. de 2025
Comentada: Walter Roberson el 5 de Jun. de 2025
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.

Respuesta aceptada

Walter Roberson
Walter Roberson el 1 de Jun. de 2025
Editada: Walter Roberson el 1 de Jun. de 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 comentarios
Nonso
Nonso el 5 de Jun. de 2025
@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 el 5 de Jun. de 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.

Iniciar sesión para comentar.

Más respuestas (0)

Categorías

Más información sobre Data Import from MATLAB en Help Center y File Exchange.

Etiquetas

Community Treasure Hunt

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

Start Hunting!

Translated by