Main Content


Get signal ID for signal at specified index in Simulink.sdi.Run object



sigID = getSignalIDByIndex(runObj,idx) returns the signal ID sigID for the signal at the specified index idx in the Simulink.sdi.Run object runObj.


You can use the signal ID to get the Simulink.sdi.Signal object that contains the signal data and metadata or perform a signal comparison using the Simulink.sdi.compareSignals function.


collapse all

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 controller.

First, load the session that contains the data.


Use the Simulink.sdi.Run.getLatest function to access the latest run in the data.

aircraftRun = Simulink.sdi.Run.getLatest;

Then, you can use the Simulink.sdi.getSignalsByName function to access the Stick signal, which represents the input to the controller, and the alpha, rad signal that represents the output.

stick = getSignalsByName(aircraftRun,'Stick');
alpha = getSignalsByName(aircraftRun,'alpha, rad');

Before you compare the signals, you can specify a tolerance value to use for the comparison. Comparisons use tolerance values specified for the baseline signal in the comparison, so set an absolute tolerance value of 0.1 on the Stick signal.

stick.AbsTol = 0.1;

Now, compare the signals using the Simulink.sdi.compareSignals function. The Stick signal is the baseline, and the alpha, rad signal is the signal to compare against the baseline.

comparisonResults = Simulink.sdi.compareSignals(stick.ID,alpha.ID);
match = comparisonResults.Status
match = 
  ComparisonSignalStatus enumeration


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.

Input Arguments

collapse all

Run that contains the desired signal, specified as a Simulink.sdi.Run object.

Index of the signal within the run, specified as an integer.

Output Arguments

collapse all

Unique numeric signal identifier, returned as an integer.

Version History

Introduced in R2012b