Main Content


Add label definitions to labeled signal set



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

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


collapse all

Load a labeled signal set containing recordings of whale songs.

load whales
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.


ans = 4x1 string

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

ans = 
       Sublabels: Sex
       Sublabels: []
       Sublabels: TrillPeaks
       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