Main Content

getLabelIndices

Get label indices pointing to label definitions in labeled signal set

Since R2022a

    Description

    idxs = getLabelIndices(lss) returns a vector of indices idxs pointing to label definitions in labeled signal set lss. Use this function to obtain label definition indices when you want to create feature data using createFeatureData.

    getLabelIndices(lss,Name=Value) returns a vector of indices pointing to label definitions in lss that have a label type and frame policy equal to the values you specify using name-value arguments. For example, LabelType="point" returns indices for point label definitions.

    example

    Examples

    collapse all

    Load a labeled signal set containing recordings of whale songs.

    load whales
    lss
    lss = 
      labeledSignalSet with properties:
    
                 Source: {2x1 cell}
             NumMembers: 2
        TimeInformation: "sampleRate"
             SampleRate: 4000
                 Labels: [2x3 table]
            Description: "Characterize wave song regions"
    
     Use labelDefinitionsHierarchy to see a list of labels and sublabels.
     Use setLabelValue to add data to the set.
    
    

    lss contains one attribute label and two region-of-interest (ROI) labels. Return label indices for the ROI labels.

    idx = getLabelIndices(lss,LabelType="roi")
    idx = 2×1
    
         2
         3
    
    

    Add an ROI feature label definition to lss. Return the label index corresponding to the ROI feature label.

    sld = signalLabelDefinition("roiFT",LabelType="roiFeature", ...
          LabelDataType="numeric",FrameSize=200,FrameOverlapLength=50);
    
    addLabelDefinitions(lss,sld);
    getLabelIndices(lss,LabelType="roiFeature")
    ans = 
    4
    

    Input Arguments

    collapse all

    Labeled signal set, specified as a labeledSignalSet object.

    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: getLabelIndices(lss,LabelType="roiFeature",FrameSize=100,FrameOverlapLength=25) returns indices corresponding to region-of-interest (ROI) feature label definitions in the input labeled signal set that have a frame size equal to 100 and a frame overlap length equal to 25.

    Label type, specified as "attribute", "roi", "point", "attributeFeature", or "roiFeature".

    Data Types: char | string

    Frame size, specified as a numeric scalar. To enable this argument, set LabelType to "roiFeature".

    Example: LabelType="roiFeature",FrameSize=50 specifies an ROI feature label type and a frame policy in which frame size is equal to 50.

    Data Types: double

    Frame overlap length, specified as a numeric scalar. To enable this argument, set LabelType to "roiFeature". You cannot specify FrameOverlapLength and FrameRate simultaneously.

    Example: LabelType="roiFeature",FrameSize=50,FrameOverlapLength=5 specifies an ROI feature label type and a frame policy in which frame size is equal to 50 and frame overlap length is equal to 5.

    Data Types: double

    Frame rate, specified as a numeric scalar. To enable this argument, set LabelType to "roiFeature. You cannot specify FrameRate and FrameOverlapLength simultaneously.

    Example: LabelType="roiFeature",FrameSize=50,FrameRate=45 specifies an ROI feature label type and a frame policy in which frame size is equal to 50 and frame rate is equal to 45.

    Data Types: double

    Output Arguments

    collapse all

    Indices pointing to label definitions in lss, returned as a vector.

    Note

    The function returns indices corresponding to parent labels only and does not consider sublabels.

    Version History

    Introduced in R2022a