How to update function's variables each sample time

1 次查看(过去 30 天)
I created a matlab function which implements DMC controller as shown , the problem is there are few vectors inside the function needs to get updated each sampling time , So is there a way to save data after each sampling time to be used for the next ones?
note: " save " function is not supported in simulink's code generation for some reason

采纳的回答

Fangjun Jiang
Fangjun Jiang 2019-9-3
Use persistent variables

更多回答(0 个)

类别

Help CenterFile Exchange 中查找有关 Model Predictive Control Toolbox 的更多信息

Community Treasure Hunt

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

Start Hunting!

Translated by