Documentation Center

  • Trial Software
  • Product Updates

Contents

getSignalByIndex

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

Return Simulink.sdi.Signal object by index

Syntax

signalObj = runObj(index)

Description

signalObj = runObj(index) returns the Simulink.sdi.Signal object, signalObj, at the index into the array of signals contained in the Simulink.sdi.Run object, runObj.

Input Arguments

index

Number specifying an index to the array of signals contained in a Simulink.sdi.Run object. The first index in the array is 1.

Output Arguments

signalObj

Handle to a Simulink.sdi.Signal object representing a signal in a run object, Simulink.sdi.Run.

Examples

The Simulink.sdi.Run method, getSignalByIndex, returns a signal object representing the signal data and information in a run. You can modify the signal object properties to configure the signal for plotting or comparing to other signals in the Simulation Data Inspector.

% Configure model "slexAircraftExample" for logging and simulate
simOut = sim('slexAircraftExample','SaveOutput','on','SaveFormat', 'StructureWithTime', ...
             'ReturnWorkspaceOutputs','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 Simulink.sdi.Signal object for the first signal in the run
if numSignals > 0
   signalObj = runObj.getSignalByIndex(1);
end

See Also

| | |

How To

Was this topic helpful?