主要内容

getSignals

Create an interface to individual signals saved in MLDATX file

Since R2026a

    Description

    sigSubset = getSignals(mldatxFileObj) creates an interface to each signal saved in an MLDATX file.

    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.

    example

    sigSubset = getSignals(mldatxFileObj,Name=Value) creates an interface to a subset of signals that match the filter options specified by the name-value arguments.

    example

    Examples

    collapse all

    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");

    You can also 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'
    
    

    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.Name
    ans =
    
        '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.Name
    ans =
    
        '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 technique used to log the 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

    collapse all

    Reference to MLDATX file that contains the signals to filter, specified as an mldatx.io.File object.

    Name-Value Arguments

    expand all

    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

    expand all

    Signal name to filter by, specified as a string or character vector.

    The Name filter option can be combined only with the RunIndex filter option and the signal name search options MatchCase and WholeWord.

    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.Name
    ans =
    
        'mysig'
    
    
    ans =
    
        'mysignal'
    
    
    ans =
    
        'mySig1'
    
    
    ans =
    
        'mySignal'
    

    To filter by whole names or matching capitalization, also include the WholeWord or MatchCase name-value arguments.

     filteredSigs = getSignals(mldatxFileObject,Name="mysig",WholeWord=true);
    >> filteredSigs.Name
    ans =
    
        '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

    The Domain filter option can be combined only with the RunIndex filter option.

    Block path of logged signal, specified as a string or character vector.

    The BlockPath filter option can be combined 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.

    The SubPath filter option can be combined with the BlockPath, PortIndex, and RunIndex filter options.

    Output port index of logged signal, specified as a positive integer.

    The PortIndex filter option can be combined with the BlockPath, SubPath, and RunIndex filter options.

    Index of run that contains the logged signal, specified as a positive integer.

    The RunIndex filter option can be combined with all other filter options.

    Signal Name Search Options

    expand all

    Option to return only case-sensitive matches, specified as true or false.

    This name-value argument can be used 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.

    This name-value argument can be used only in combination with the Name, BlockPath, and SubPath filter options.

    Example: filteredSigs = getSignals(myFileObj,Name="mySigName",WholeWord=true)

    Output Arguments

    collapse all

    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