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 Optimization tool session. Optimize the model, and export the design variable set values for the third iteration.
Open the Simulink model and load the preconfigured Response Optimization tool session.
The Response Optimization tool opens and loads the preconfigured
session. Iteration Plot 1 is configured to plot
the values of
DesignVars for each optimization
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
[0 2 5].
In Save to a variable named,
Export the design variable values set.
Click OK. The exported data variable,
appears in the Data area of the tool.
The iteration number is added as a suffix to the saved data variable name.