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.

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.

Output Arguments

collapse all

Label names, returned as a string array.

Sublabel names, returned as a string array.

Introduced in R2018b