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

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

采纳的回答

Midhulesh Vellanki
Midhulesh Vellanki 2022-5-20
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.

更多回答(0 个)

类别

Help CenterFile Exchange 中查找有关 Sources 的更多信息

产品


版本

R2022a

Community Treasure Hunt

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

Start Hunting!

Translated by