You can use the Simulink.sdi.getSubplotLimits
and Simulink.sdi.setSubplotLimits
functions to copy the axis limits from one subplot to another. For example, you can specify the same y-axis limits for two subplots that display the same signal from simulations that used different values of a model parameter. This example copies the y-axis settings from one subplot to another to analyze the effect of changing the value of Mu
in the model vdp
.
Create the data in the Simulation Data Inspector by simulating the model vdp
twice. The first time, specify the value of Mu
as 1
. For the second simulation, set the value of Mu
to 2
. The model logs data for the signals x1
and x2
.
Open the Simulation Data Inspector.
Create plots in the Simulation Data Inspector to show the results from each simulation. Configure a 2x2
subplot layout so you can plot one signal on each plot, side by side.
Get the Simulink.sdi.Signal
objects that correspond to each signal from each run, and plot one signal on each subplot. Plot the signals from the first simulation on the subplots in the first column and the signals from the second simulation on the subplots in the second column.
The signals in the first column of plots look similar to those in the second column. However, the y-axis limits for the plots of the x2
signal are different.
Use the Simulink.sdi.getSubplotLimits
function to copy the limits used for the subplot with the x2
signal from the second simulation.
Use the Simulink.sdi.setSubplotLimits
function to apply the same y-axis limits to the subplot with the x2
signal from the first run.
With the updated y-axis limits, the difference in the x2
signal is more apparent.