You can use the Simulation Data Inspector programmatic interface to compare signals within a single run. This example compares the input and output signals of an aircraft longitudinal flight controller.
Load the Simulation Data Inspector session file that contains the flight control data.
To access the latest run, use the Simulink.sdi.Run.getLatest function.
Use the Simulink.sdi.getSignalsByName function to access the Stick signal, which represents the input to the controller, and the alpha, rad signal, which represents the output.
Use the signal IDs to compare the Stick and alpha, rad signals using the Simulink.sdi.compareSignals function. The Stick signal is the baseline. The alpha, rad signal is the signal to compare against the baseline.
match =
ComparisonSignalStatus enumeration
OutOfTolerance
The comparison result is out of tolerance. You can use the Simulink.sdi.view function to open the Simulation Data Inspector to view and analyze the comparison results.
You can specify time and magnitude tolerance values to use for the comparison. Comparisons use tolerance values specified for the baseline signal in the comparison. To account for the phase shift, set a time tolerance of 1 on the Stick signal. To account for magnitude differences, set an absolute tolerance value of 0.1 on the Stick signal.
Compare the signals again. This time, because of the absolute and time tolerances, the signal comparison passes.
match =
ComparisonSignalStatus enumeration
WithinTolerance