Main Content

addLabelDefinitions

Add label definitions to labeled signal set

Description

addLabelDefinitions(lss,lbldefs) adds the labels defined in the vector of signal label definitions lbldefs to the labeled signal set lss.

example

addLabelDefinitions(lss,lbldefs,lblname) adds the labels defined in lbldefs as sublabels of the label lblname.

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.

Create a label definition that specifies whether a signal corresponds to a calf or to an adult whale.

calf = signalLabelDefinition("Calf", ...
    LabeldataType="logical",DefaultValue=false, ...
    Description="Is the specimen a calf, or an adult?")
calf = 
  signalLabelDefinition with properties:

                  Name: "Calf"
             LabelType: "attribute"
         LabelDataType: "logical"
    ValidationFunction: []
          DefaultValue: 0
             Sublabels: [0x0 signalLabelDefinition]
                   Tag: ""
           Description: "Is the specimen a calf, or an adult?"

 Use labeledSignalSet to create a labeled signal set.

Add the definition to the labeled signal set. Retrieve the names of the labels.

addLabelDefinitions(lss,calf)

getLabelNames(lss)
ans = 4x1 string
    "WhaleType"
    "MoanRegions"
    "TrillRegions"
    "Calf"

Create a label definition that specifies the sex of the whale. Add the label to the set as a sublabel of 'WhaleType'.

sx = signalLabelDefinition("Sex",LabelDataType="categorical", ...
    Categories=["male" "female"]);
addLabelDefinitions(lss,sx,"WhaleType")

labelDefinitionsHierarchy(lss)
ans = 
    'WhaleType
       Sublabels: Sex
     MoanRegions
       Sublabels: []
     TrillRegions
       Sublabels: TrillPeaks
     Calf
       Sublabels: []
     '

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'.

Signal label definitions, specified as a signalLabelDefinition object or a vector of signalLabelDefinition objects.

Example: signalLabelDefinition("Asleep",'LabelType','roi','LabelDataType','logical') can label a region of a signal in which a patient is asleep.

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.

Version History

Introduced in R2018b