Simulink.sdi.getSignal
Get Simulink.sdi.Signal object for a signal
Description
returns a signalObj
= Simulink.sdi.getSignal(sigID
)Simulink.sdi.Signal
object for the
signal in the Simulation Data Inspector that corresponds to the signal ID,
sigID
.
Examples
Create Simulation Data Inspector Run and Access Signal Data
You can create a run in the Simulation Data Inspector using data from the workspace.
Generate Data for Run
Create timeseries data for sine and cosine signals. Give each signal a descriptive name.
time = linspace(0, 20, 101); sine_vals = sin(2*pi/5*time); sine_ts = timeseries(sine_vals,time); sine_ts.Name = "Sine, T=5"; cos_vals = cos(2*pi/8*time); cos_ts = timeseries(cos_vals,time); cos_ts.Name = "Cosine, T=8";
Create Run and Return Signal IDs
Use the Simulink.sdi.createRun
function to create a run for the sinusoid data. You can use multiple return arguments to get the run ID, run index, and signal IDs directly. If you do not return the signal ID using the Simulink.sdi.createRun
function, you can access the signal IDs through the Simulink.sdi.Run
object.
[runID,runIndex,sigIDs] = Simulink.sdi.createRun("Sinusoids","vars",... sine_ts,cos_ts);
Modify Signal Properties and View in Simulation Data Inspector
Use the second signal ID in the returned sigIDs
vector to get the Simulink.sdi.Signal
object corresponding to the cosine wave.
cosID = sigIDs(2); cosSig = Simulink.sdi.getSignal(cosID);
You can view and modify the signal properties for a Simulink.sdi.Signal
object. For example, set the Checked
property of cosSig
to true
to plot the signal in the Simulation Data Inspector. Then, open the Simulation Data Inspector to view the signal data.
cosSig.Checked = true; Simulink.sdi.view
Input Arguments
sigID
— Signal ID
scalar
Unique, numeric signal identifier, specified as an integer. The Simulation Data Inspector assigns a signal ID to each signal when a run is created. You can get the signal ID for a signal using one of these functions:
Output Arguments
signalObj
— Simulink.sdi.Signal
object
Simulink.sdi.Signal
object
Signal that corresponds to the signal ID, sigID
,
returned as a Simulink.sdi.Signal
object.
Version History
Introduced in R2011b
See Also
Objects
Functions
Open Example
You have a modified version of this example. Do you want to open this example with your edits?
MATLAB Command
You clicked a link that corresponds to this MATLAB command:
Run the command by entering it in the MATLAB Command Window. Web browsers do not support MATLAB commands.
Select a Web Site
Choose a web site to get translated content where available and see local events and offers. Based on your location, we recommend that you select: .
You can also select a web site from the following list:
How to Get Best Site Performance
Select the China site (in Chinese or English) for best site performance. Other MathWorks country sites are not optimized for visits from your location.
Americas
- América Latina (Español)
- Canada (English)
- United States (English)
Europe
- Belgium (English)
- Denmark (English)
- Deutschland (Deutsch)
- España (Español)
- Finland (English)
- France (Français)
- Ireland (English)
- Italia (Italiano)
- Luxembourg (English)
- Netherlands (English)
- Norway (English)
- Österreich (Deutsch)
- Portugal (English)
- Sweden (English)
- Switzerland
- United Kingdom (English)