Main Content

getLabelNames

Get label names in labeled signal set

Description

example

lblnames = getLabelNames(lss) returns a string array containing the label names in the labeled signal set lss.

sublblnames = getLabelNames(lss,lblname) returns a string array containing the sublabel names for the label named lblname in the labeled signal set lss.

getLabelNames(lss,Name=Value) returns a string array containing the label names in the labeled signal set for labels which have a label type and frame policy equal to the values you specify using name-value arguments.

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.

Get the names of the labels in the set.

str = getLabelNames(lss)
str = 3x1 string
    "WhaleType"
    "MoanRegions"
    "TrillRegions"

Verify that only the 'TrillRegions' label has sublabels.

for kj = 1:length(str)
    sbstr = str{kj};
    sbl = [sbstr getLabelNames(lss,sbstr)]
end
sbl = 
"WhaleType"
sbl = 
"MoanRegions"
sbl = 1x2 string
    "TrillRegions"    "TrillPeaks"

Input Arguments

collapse all

Labeled signal set, specified as a labeledSignalSet object.

Example: labeledSignalSet({randn(100,1) randn(10,1)},signalLabelDefinition('female')) specifies a two-member set of random signals containing the attribute 'female'.

Label name, specified as a character vector or a string scalar.

Example: signalLabelDefinition("Asleep",'LabelType','roi') specifies a label of name "Asleep" for a region of a signal in which a patient is asleep during a clinical trial.

Name-Value Arguments

Example: getLabelNames(lss,LabelType="roiFeature",FrameSize=50,FrameOverlapLength=5) returns the names of roiFeature labels which have a frame size equal to 50 and a frame overlap length equal to 5.

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.

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

Example: LabelType="attribute"

Data Types: char | string

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

Example: LabelType="roiFeature",FrameSize=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

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

Data Types: double

Output Arguments

collapse all

Label names, returned as a string array.

Sublabel names, returned as a string array.

Version History

Introduced in R2018b