Running Simulink Model in for loop

2 views (last 30 days)
I'm trying to run a Simulink model within a for loop so I can vary the input parameters. I tried using the sim command but it takes a long time to compile each run which makes it impractical for generating a large amount of data. Is there any way to reduce the compiling speed or compile the simulation once before the for loop?
Any help is much appreciated. Thanks

Accepted Answer

Madhu Govindarajan
Madhu Govindarajan on 2 Oct 2018
I think overall the concept of Model referencing might be of value to you (https://www.mathworks.com/help/simulink/model-reference.html). I say this because, when you reference a model you can set not to recompile this model as long as nothing inside it has changed. Then you would use that setting to not include any of your varying parameters and you do not have to recompile. The catch though would be if you are changing something at the core of your algorithm, then you might be forced to recompile every time.
Just my 2c, Madhu

More Answers (0)

Categories

Find more on Simulink Coder in Help Center and File Exchange

Products


Release

R2017b

Community Treasure Hunt

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

Start Hunting!