How do I call a script to modify base workspace variables in the PreSimFcn of "parsim"?
5 views (last 30 days)
Show older comments
MathWorks Support Team
on 23 Jun 2021
Answered: MathWorks Support Team
on 16 Sep 2021
I have a script which I usually call to modify my base workspace variables before simulation. I am now trying to move to a "parsim" workflow, and need to use the Simulink.SimulationInput objects. Is there a way I can call this script in the PreSimFcn of the Simulink.SimulationInput so that my variables are correctly set before each simulation? I don't want to have to set each variable with the setVariable() method on the Input Object.
Accepted Answer
MathWorks Support Team
on 23 Jun 2021
Please find such an example attached. It uses a script to change the value of “Ka” in the base workspace based on the run number. It uses evalin() in the PreSimFcn to both assign the dependent variables and call the script in the base workspace.
0 Comments
More Answers (0)
See Also
Categories
Find more on Run Multiple Simulations in Help Center and File Exchange
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!