How to initialize Simulink Data Store Memories with Real Time Windows Target
Ältere Kommentare anzeigen
Hi!
I use Data Store Memories through various subsystems of my Simulink Model. I use the Data Store Memory Block in the model root level. In the field "Initial Value" of this block I entered a workspace variable "InitVal". If I compile (built) the Model for Real Time Windows Target, the value of InitVal is used as initial value of the Data Store.
And here is the problem: If I now change the value of the workspace variable InitVal (for example from a m-file), then connect to the target and start the simulation (both from a m-file), the initial value of the Data Store Memory is not updated. It stays at the value that InitVal had, when the model was built.
Is there any possibility to init a Data Store Memory in a compiled Simulink Model from a m-file? Without re-building.
Thank you very much for your answers! Arne
Antworten (2)
Jan Houska
am 7 Feb. 2013
2 Stimmen
You are correct that this does not work and it should. I'm filing a bug record for this.
To work around the problem, you can use Data Store Write together with an enabled subsystem. First, connect a Data Store Write block with constant with the value of InitVal. Then put these two blocks into an enabled subsystem. And, connect the enable port of the subsystem to an output of Clock compared with zero. This way, the Data Store is initialized by InitVal at simulation start and not affected later. If you are interested in an example model, please send me an e-mail.
2 Kommentare
Jan Houska
am 8 Feb. 2013
I don't know about any possibility to write Data Store in compiled code using MATLAB code. Only parameters can be changed from MATLAB code, but the immediate value is not a parameter. The initial value is a parameter, but it is too late to change it after the model is loaded and initailized.
Currently, I think there is no workaround other than already presented above.
Arne
am 11 Feb. 2013
0 Stimmen
1 Kommentar
Jan Houska
am 12 Feb. 2013
Yes, this is the same problem and will be solved by the same bug fix.
Kategorien
Mehr zu System Configuration finden Sie in Hilfe-Center und File Exchange
Produkte
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!