Simulate Model and Get Run Object
Configure the vdp
model to save output data. Run a simulation to create data.
Use the Simulation Data Inspector programmatic interface to access the run data.
Modify Signal View Settings
Use the Simulink.sdi.Run
object to access signals in the run. Then, modify the signal view settings. This example specifies the line color and style for each signal. The view settings for the run comprise the view settings for each signal and view settings specified for the plot area.
Capture Snapshot from Simulation Data Inspector
Create a Simulink.sdi.CustomSnapshot
object and use the Simulink.sdi.snapshot
function to programmatically capture a snapshot of the contents of the Simulation Data Inspector.
You can use properties of the Simulink.sdi.CustomSnapshot
object to configure the plot settings, such as the subplot layout and axis limits, and to plot signals. When you use a Simulink.sdi.CustomSnapshot
object to create your figure, these plot settings do not affect the Simulation Data Inspector.
Use the Simulink.sdi.snapshot
function to generate the figure you specified in the properties of the Simulink.sdi.CustomSnapshot
object.
Copy View Settings to New Simulation Run
Simulate the model again, with a different Mu
value. Use the Simulation Data Inspector programmatic interface to access the simulation data.
To create a plot of the new output data that looks like the one you created in the previous step, you can copy the view settings to the run in a single line of code using the Simulink.sdi.copyRunViewSettings
function. This function does not automatically update plot settings in Simulink.sdi.CustomSnapshot
objects, so specify the input that determines whether the plot updates as false
.
Capture Snapshot of New Simulation Run
Use the Simulink.sdi.CustomSnapshot
object to capture a snapshot of the new simulation run. First, clear the signals from the subplots. Then, plot the signals from the new run and capture another snapshot.