maybe this might be a simple problem but after a long while at Google and the search function I didn’t find any answer to the following question:
I have a simulink model which need some input params. I want this model to be executed in a loop with different params each run. How do I do this?
And how am I able to retrieve the output of my model in order to use them for further operations in the m-file? Do I have any special block for giving the results out to my m-file? The bridge between simulink and matlab seems to me very unclear in this case…
Can someone help me understanding this issue?
Firstly, you need to use the
simcommand (ref page, “using sim command” page) to run the model.You need to set up the parameters for your model prior to each call to
sim. There are multiple ways you can do this, but in the simplest case where you have a block with a parameter called, say,N, you might do something like this:To get stuff to show up in your simulation results structures (
simOut), you should add root-level outport blocks.As a concrete example, consider the standard demo model
vdp. This has no parameters, but the following shows how to capture outputs: