how to maintaing the last value of a variable to be used in the next loop cycle of a simulation?

3 Ansichten (letzte 30 Tage)
Dear all,
I just wondering how to extract/save the last value registered from a time-series, to furtherly use it in the following loop iteration as the initial value (for a specific variable). I think worth highlighting this is a model designed in Simulink and ran using scripts of MATLAB.
Thanks in advance !!

Akzeptierte Antwort

Midhulesh Vellanki
Midhulesh Vellanki am 20 Mai 2022
For a timeseries variable you can access data using Data property.If your variable name is `var`, use `var.Data(end)` to access the last value of the timeseries.

Weitere Antworten (0)

Kategorien

Mehr zu Simulink Functions finden Sie in Help Center und File Exchange

Produkte


Version

R2022a

Community Treasure Hunt

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

Start Hunting!

Translated by