Main Content

getAllSignalIDs

Get all signal IDs for signals in Simulink.sdi.Run object

Since R2020a

Description

sigIDs = getAllSignalIDs(runObj) returns an array, sigIDs, that contains the signal IDs for all signals in the Simulink.sdi.Run object runObj. Use the getAllSignalIDs function when you need to work with many or all of the signals in the run. When you only need to analyze a specific signal, you can access the single Signal object using the getSignalIDsByName function or the getSignalIDByIndex function.

example

Examples

collapse all

You can use the getAllSignalIDs function to access an array containing the signal IDs for all the signals in a run. This example simulates the slexAircraftExample model to create run data and then shows how to get the signal IDs for the signals in the run and use the IDs to compare the signals.

Create a Run

This example creates a run in the Simulation Data Inspector by simulating a model that logs data. Load the slexAircraftExample model and mark the Stick and alpha, rad signals for logging.

load_system('slexAircraftExample')

Simulink.sdi.markSignalForStreaming('slexAircraftExample/Pilot',1,'on')
Simulink.sdi.markSignalForStreaming('slexAircraftExample/Aircraft Dynamics Model',4,'on')

Simulate the model.

out = sim('slexAircraftExample');

Access Run Data and Signal IDs

Use the Simulink.sdi.getCurrentSimulationRun function to access the run created when you simulated the slexAircraftExample model.

airRun = Simulink.sdi.getCurrentSimulationRun('slexAircraftExample');

Get an array of the signal IDs for the logged signals using the getAllSignalIDs function.

sigIDs = getAllSignalIDs(airRun);

Compare Logged Signals

You can use the signal IDs to compare the logged signals. Use the Simulink.sdi.getSignal function to get the Simulink.sdi.Signal object with the first ID in the array sigIDs. Check the Name property for the returned Signal object.

sigID1 = sigIDs(1);
sig1 = Simulink.sdi.getSignal(sigID1);
sig1.Name
ans = 
'alpha, rad'

Use the input signal, Stick, as the baseline signal in the signal comparison.

sigID2 = sigIDs(2);
DSR = Simulink.sdi.compareSignals(sigID2,sigID1);
DSR.Status
ans = 
  ComparisonSignalStatus enumeration

    WithinTolerance

The signals do not match. You can use the tolerance properties of the Signal objects to programmatically analyze the data, or you can open the Simulation Data Inspector using the Simulink.sdi.view function to view and analyze the comparison results using the UI.

Input Arguments

collapse all

Run containing the signals you want to access, specified as a Simulink.sdi.Run object.

Output Arguments

collapse all

Signal IDs for the signals in the run, returned as an array.

Version History

Introduced in R2020a