- Do these variables change only at the end of the simulation so that it can be used for the next time you start a simulation? Then you can put it in the StopFcn callback (Documentation here).
- If the variables change EVERY time step during the simulation, try putting it in a MATLAB function block since this would execute every time step (Documentation here).
How do I modify variables in the model workspace from a Simulink block?
35 Ansichten (letzte 30 Tage)
Ältere Kommentare anzeigen
My Simulink block diagram has many gains whose values are variables stored in the Model Workspace.
I need to modify these gains dynamically using blocks in Simulink i.e. when a triggered subsystem is run, many of these gains have to change to new values specified by some Simulink block. I want these values to persist even after I terminate the simulation.
If this is possible, what block can do this?
Thanks.
0 Kommentare
Antworten (1)
Swarooph
am 3 Aug. 2016
Jeeven,
You can manipulate model workspace variables using MATLAB commands on a Simulink.Workspace variable. Refer to the following documentation to see how to make that happen in your particular case:
As to WHERE you would put these commands, it depends on your scenario.
2 Kommentare
Siehe auch
Kategorien
Mehr zu Subsystems finden Sie in Help Center und File Exchange
Produkte
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!