Yes. We will assume 'model' is the name of our model that we wish to run, and that this model has an already-defined struct "x" that contains tunable parameters set by fields "a" and "b", e.g.:
In this case, we can change the parameters and simulate in Rapid Accelerator mode as follows.
Get the current model and parameter structure:
rtp = Simulink.BlockDiagram.buildRapidAcceleratorTarget(model)
Set new values for the parameters:
Modify the parameters in our model object:
parameterSet = Simulink.BlockDiagram.modifyTunableParameters(rtp,'x',x)
Simulate again:
simout = sim(model,'SimulationMode','rapid', 'RapidAcceleratorUpToDateCheck','off', 'RapidAcceleratorParameterSets',parameterSet)
This is similar to the workflow described in the following documentation, although it does not require parallel computing:
Note that the generated executable resides in the slprj > raccel > model folder, rather than the top-level directory as it does with "RSim."
Read more about this here:
https://blogs.mathworks.com/simulink/2015/03/19/getting-the-most-out-of-rapid-accelerator-mode/
Best Answer