Start Simulink sim with persistent variables, using stored state
Mostra commenti meno recenti
I have a simulink simulation with matlab function blocks that contain persistent variables.
Since switching to Matlab R2022, (from R2021a) I have been unable to start my Simulink sim from a saved state and have have the persistent variables populated. Is there something particular that needs to be done to save the persistent variables? These revert to the null vector when starting from a saved state.
5 Commenti
Paul
il 16 Feb 2023
Hi Leena,
Are you using the workflow for Model Operating Point to save the final state from the first sim and use that to intialize the second simulation?
Leena Singh
il 16 Feb 2023
Paul
il 16 Feb 2023
I'll just note that the doc page I linked doesn't say anything explicitly about Matlab Function blocks or saving persistent variables in those blocks. But, if it worked in 2021a, no reason to think it shouldn't work in 2022a (or b), unless there was a documented behavior change (or maybe in 2021a it was an undocumented feature that could be removed at any time). Maybe the Release Notes from 2021a onward indicate a change to Model Operating Point behavior? If you can't find anything there, you can always contact Tech Support and see what they have to say about this.
Leena Singh
il 16 Feb 2023
Paul
il 16 Feb 2023
I should have suggested to also check the Bug reports as well.
If you do contact Tech Support, would you mind posting back here summarizing the response? Probably of interest to others using the Model Operating Point feature.
Risposte (1)
Sulaymon Eshkabilov
il 15 Feb 2023
0 voti
Suppose that you have followed these guides with the persistent variable initialization in your model: DOC
1 Commento
Leena Singh
il 15 Feb 2023
Categorie
Scopri di più su Simulink Environment Customization in Centro assistenza e File Exchange
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!