How can I store data from my simulink model in and and use it during runtime.

How can I store data from my simulink model in and and use it during runtime. I used the data store blocks and trigger subsystem to enable data store only during specific events. But at a sample time of 1e-4 sec there's a lot of data. I want to only buffer 50 points.

2 Comments

Depending on what you need to do with the stored signals, one possibility is the Propagation Delay block; https://www.mathworks.com/help/simulink/slref/propagationdelay.html
"Thanks for the suggestion! Let me clarify my specific use case, as I am not sure the Propagation Delay block fits my constraints. At my sample time of 1e-4 sec, continuous data logging is too heavy. I only want to capture some let's say 100 samples following a trigger event that I am setting up for my system. Once collected, the buffer needs to stop recording and output that 100 element array to a downstream subsystem for frequency-domain calculations in the following fundamrntal time steps. Since this is not post simulation analysis rather runtime so I cannot use 'ToWorkspace' block as well.

Sign in to comment.

Answers (1)

Does the trigger event enable the execution of an enbabled subsystem? Is the data to be captured from a signal inside that enabled subsystem? Do you only need the 100-element array once? Or do you need a sequence of 100-element arrays, i.e., in this example process a new 100-element array every 1e-2 sec?
A bit more detail on the model strucuture would be helpful to be more helpful.

Products

Asked:

on 28 Feb 2026

Edited:

on 5 Mar 2026

Community Treasure Hunt

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

Start Hunting!