Documentation

This is machine translation

Translated by Microsoft
Mouseover text to see original. Click the button below to return to the English verison of the page.

Note: This page has been translated by MathWorks. Please click here
To view all translated materals including this page, select Japan from the country navigator on the bottom of this page.

getSignal

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

Return Simulink.sdi.Signal object by signal ID

Syntax

signalObj = runObj.getSignal(signalID)

Description

signalObj = runObj.getSignal(signalID) returns the Simulink.sdi.Signal object, signalObj, corresponding to the signal ID, signalID, stored in the Simulink.sdi.Run object, runObj.

Input Arguments

expand all

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

Output Arguments

expand all

A signal within a run object, Simulink.sdi.Run, returned as a Simulink.sdi.Signal object.

Examples

expand all

The Simulink.sdi.Run method, getSignal, returns a signal object representing the signal data and metadata 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,runIndex,signalIDs] = 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 objects for each signal
% in the run and select for plotting 
for i = 1:numSignals
   signalObjs(i) = runObj.getSignal(signalIDs(i));
   signalObjs(i).checked = true;
end

Introduced in R2012b

Was this topic helpful?