Class: Simulink.sdi.Run
Package: Simulink.sdi

Determine if signal ID is valid within run


isValid = runObj.isValidSignalID(signalID)


isValid = runObj.isValidSignalID(signalID) returns true if the signal ID, signalID, corresponds to a signal in the run object, runObj. Otherwise, it returns false.

Input Arguments

expand all

Unique number identifying a signal stored in the run object, specified as an integer.

Output Arguments

expand all

A Boolean value: true, if the signal exists; false, otherwise.


expand all

Before calling a function that takes a signal ID as input, verify that the signal ID is valid.

% Configure model "slexAircraftExample" for logging and simulate
simOut = sim('slexAircraftExample','SaveOutput','on',...
% Create a Simulation Data Inspector run
runID = Simulink.sdi.createRun('My Run','base',{'simOut'});
% Get the Simulink.sdi.Run object corresponding to the new run ID
runObj = Simulink.sdi.getRun(runID);
% Get the number of signals in the run
numSignals = runObj.signalCount;
% Get the signal ID for the first signal in the run
if numSignals > 0
   signalID = runObj.getSignalIDByIndex(1);

% Before calling getSignal, check that the signalID is valid 
if runObj.isValidSignalID(signalID)
	   signalObj = runObj.getSignal(signalID)

Related Examples

Introduced in R2012b

Was this topic helpful?