Get all signal IDs for signals in
returns an array,
sigIDs = getAllSignalIDs(
sigIDs, that contains the signal IDs for all signals in
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
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
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
Simulink.sdi.getCurrentSimulationRun function to access the run created when you simulated the
airRun = Simulink.sdi.getCurrentSimulationRun('slexAircraftExample');
Get an array of the signal IDs for the logged signals using the
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
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 = OutOfTolerance
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.
sigIDs— Signal IDs for signals in run
Signal IDs for the signals in the run, returned as an array.