Save Design Variable Values for Specific Iteration
This example shows how to save the design variable values for specific optimization iterations.
During optimization, the optimization solver simulates the model using a different set of design variables at each iteration. After the optimization completes, you can export the values for an iteration from the iteration plot of the design variable set.
For this example, load a preconfigured Response Optimizer session. Optimize the model, and export the design variable set values for the third iteration.
Open the Simulink model and load the preconfigured Response Optimizer session.
The Response Optimizer opens and loads the preconfigured session.
Iteration Plot 1 is configured to plot the values of
DesignVars for each optimization iteration.
The optimization completes after four iterations.
Select the iteration plot of the design variable set.
Click Iteration plot 1.
Open the Save Iteration Data dialog box.
Right-click on the iteration plot, and select Save Iteration Data.
You can also access the Save Iteration Data dialog box from the Optimization Progress Report. To do so, in the progress report, click Save Iteration.
Specify details about the design variable data to save:
In the Data to save list, select
In Iteration(s) to save, enter
To specify multiple iterations, use a vector of integers. For example,
[0 2 5].
In Save to a variable named, enter
Export the design variable values set.
Click OK. The exported data variable,
DesignVars_iter_3, appears in the
Data area of the app.
The iteration number is added as a suffix to the saved data variable name.