getSignals
R2026bDescription
creates an interface to each signal saved in an MLDATX file. Use this interface to select
signals for loading.sigSubset = getSignals(mldatxFileObj)
getSignals returns an array of mldatx.io.Signal
objects where each mldatx.io.Signal object acts as an interface to a signal
in the MLDATX file referenced by the mldatx.io.File
object mldatxFileObj.
creates an interface to a subset of signals that match the filter options specified by the
name-value arguments. sigSubset = getSignals(mldatxFileObj,Name=Value)
Examples
Create an mldatx.io.File object referencing a saved
MLDATX file. The mldatx.io.File object is an interface to the MLDATX file
as a whole.
myFileObj = mldatxfile("MyFile.mldatx");To interact with the individual signals in an MLDATX file, you can create a separate
interface for each signal in an MLDATX file. To create an array of
mldatx.io.Signal objects that each reference a signal in the MLDATX
file, use the mldatx.io.File object as input to the
getSignals function.
allSigs = getSignals(myFileObj); allSigs.Name
ans =
'sineSig'
ans =
'rampSig'
ans =
'constSig'
Use allSigs with load to
import data from these signals.
Create an mldatx.io.File object referencing a saved MLDATX
file.
myFileObj = mldatxfile("MyFile.mldatx");Create an interface to the signals in the MLDATX file with names that contain
mysig. By default, results are case-insensitive and need not be the
whole word.
mySigs = getSignals(myFileObj,Name="mysig");
mySigs.Nameans =
'mysig'
ans =
'mysignal'
ans =
'mySig1'
ans =
'mySignal'To filter signals with whole-word or case-sensitive matching, use the
WholeWord or MatchCase name-value arguments. For
example, filter the results to include only the signals with matching
capitalization.
mySigsCaseMatch = getSignals(myFileObj,Name="mysig",MatchCase=true);
mySigsCaseMatch.Nameans =
'mysig'
ans =
'mysignal'Create an mldatx.io.File object referencing a saved MLDATX
file.
myFileObj = mldatxfile("MyFile.mldatx");An MLDATX file can contain data from multiple simulation runs. Use the
RunIndex filter option to create an interface to only the signals
from a particular run. For example, return all the signals in the third run.
mySigsThirdRun = getSignals(myFileObj,RunIndex=3)
Create an mldatx.io.File object referencing a saved MLDATX
file.
myFileObj = mldatxfile("MyFile.mldatx");Simulink.sdi.Signal objects have metadata that specifies the origin
of the logged signal such as signal logging, Outport blocks, or the
Record block. You can filter signals in the MLDATX file based on the
logging origin. For example, return the signals in the MLDATX file that were logged
using the Record block.
mySigs = getSignals(myFileObj,Domain="Record")Create an mldatx.io.File object referencing a saved MLDATX
file.
myFileObj = mldatxfile("MyFile.mldatx");You can get an interface to subset of signals connected to a specific block using
the block path. For example, get an interface to the signals connected to the output
port of the Playback block in the model myModel.
mySigsPlayback = getSignals(myFileObj,BlockPath="myModel/Playback");
You can combine the BlockPath filter option with the
SubPath and PortIndex filters. For example, get
an interface to the signal connected to the second port of the Playback block.
mySigPlayback2 = getSignals(myFileObj,BlockPath="myModel/Playback",PortIndex=2);
Input Arguments
Reference to MLDATX file that contains the signals to filter, specified as an
mldatx.io.File object created with mldatxfile.
Name-Value Arguments
Specify optional pairs of arguments as
Name1=Value1,...,NameN=ValueN, where Name is
the argument name and Value is the corresponding value.
Name-value arguments must appear after other arguments, but the order of the
pairs does not matter.
Example: mySigsThirdRun =
getSignals(myFileObj,RunIndex=3)
Filter Options
Signal name to filter by, specified as a string or character vector.
By default, when you use the Name option, the subset of
filtered signals includes all signals with partially matching names, regardless of
case.
filteredSigs = getSignals(mldatxFileObject,Name="mysig");
filteredSigs.Nameans =
'mysig'
ans =
'mysignal'
ans =
'mySig1'
ans =
'mySignal'
To further narrow down the signals to load, you can combine the
Name filter option with the RunIndex filter
option and the signal name search options MatchCase and
WholeWord. For example, get only the signal whose whole name is
mysig.
filteredSigs = getSignals(mldatxFileObject,Name="mysig",WholeWord=true);
>> filteredSigs.Nameans =
'mysig'Example: filteredSigs =
getSignals(myFileObj,Name="mySigName",MatchCase=true,WholeWord=true)
Logging domain of signal to filter by, specified as a string or character vector such as one of these options:
"Signals"— Signal logging data"Outports"— Output logging data"States"— States logging data"Data Store Memory"— Data store memory logging data"Parameters"— Logged parameter data"Stateflow"— Stateflow® data"Simscape"— Simscape™ data"Assessments"— Simulink® Test™ assessment data"Profiling"— Execution profiling data
You can combine the Domain filter option only with the
RunIndex filter option.
Block path of logged signal, specified as a string or character vector.
You can combine the BlockPath filter option with the
SubPath, PortIndex, and
RunIndex filter options.
Component of block containing logged data, specified as a string or character
vector. For example, if the block path refers to a Stateflow chart, you can use SubPath to filter results by chart
signals.
You can combine the SubPath filter option with the
BlockPath, PortIndex, and
RunIndex filter options.
Output port index of logged signal, specified as a positive integer.
You can combine the PortIndex filter option with the
BlockPath, SubPath, and
RunIndex filter options.
Index of run that contains the logged signal, specified as a positive integer.
You can combine the RunIndex filter option with all other
filter options.
Signal Name Search Options
Option to return only case-sensitive matches, specified as true
or false.
You can use this name-value argument only in combination with the
Name, BlockPath, and
SubPath filter options.
Example: filteredSigs =
getSignals(myFileObj,Name="mySigName",MatchCase=true)
Option to return only whole word matches, specified as true or
false.
You can use this name-value argument only in combination with the
Name, BlockPath, and
SubPath filter options.
Example: filteredSigs =
getSignals(myFileObj,Name="mySigName",WholeWord=true)
Output Arguments
Interface to subset of signals saved in an MLDATX file, returned as an
mldatx.io.Signal object or an array of
mldatx.io.Signal objects.
Version History
Introduced in R2026a
See Also
Functions
Objects
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)