How to store data in Simulink and reuse them before the simulation ends

5 views (last 30 days)
Hello everyone,
I want to store timeseries data during a Simulink simulation, mirror the input and give it back at another point later, but before the simulation ends. This is why I can not use a Sink block (To Workspace).
How is this possible?

Answers (1)

Spruha
Spruha on 21 Feb 2025
Hi Christos,
I see you want to store timeseries data during Simulink simulation and use it later, before the simulation ends.
You can use these blocks in your model.
  1. “Data Store Memory” block can store the time series data and let you use it later in the simulation.
  2. Use the “Data Store Write” block to write data to the “Data Store Memory” at the right moment during the simulation.
  3. If you want to mirror the data, use the “Data Store Read” block to get the data from the “Data Store Memory” and send it out.
You may refer to following Model:
  • The "Data Store Write" block writes data(myData).
  • The "Data Store Memory" block stores data.
  • The "Data Store Read" block mirrors the stored data.
  • A "Gain" block processes the data during the same simulation.
  • A Scope verifies that the stored and read data are identical and processed input shows gain by 2.
You may refer to the following documentation about “Data Store Memory”, “Data Store Write” and “Data Store Read”
Hope this helps!

Categories

Find more on Modeling 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!