Main Content

getLabelDefinitions

Get label definitions in labeled signal set

Description

example

lbldefs = getLabelDefinitions(lss) returns a vector of signalLabelDefinition objects with the labels of the labeled signal set lss.

Changing lbldefs does not affect the labeled set. To modify label definitions, use editLabelDefinition, addLabelDefinitions, and removeLabelDefinition.

getLabelDefinitions(lss,Name=Value) returns a vector of signalLabelDefinition objects that 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.

Retrieve the definitions of the labels in the set.

dfs = getLabelDefinitions(lss);

for k = 1:length(dfs)
    dfs(k)
end
ans = 
  signalLabelDefinition with properties:

             Name: "WhaleType"
        LabelType: "attribute"
    LabelDataType: "categorical"
       Categories: [3x1 string]
     DefaultValue: []
        Sublabels: [0x0 signalLabelDefinition]
              Tag: ""
      Description: "Whale type"

 Use labeledSignalSet to create a labeled signal set.

ans = 
  signalLabelDefinition with properties:

                  Name: "MoanRegions"
             LabelType: "roi"
         LabelDataType: "logical"
    ValidationFunction: []
     ROILimitsDataType: "double"
          DefaultValue: []
             Sublabels: [0x0 signalLabelDefinition]
                   Tag: ""
           Description: "Regions where moans occur"

 Use labeledSignalSet to create a labeled signal set.

ans = 
  signalLabelDefinition with properties:

                  Name: "TrillRegions"
             LabelType: "roi"
         LabelDataType: "logical"
    ValidationFunction: []
     ROILimitsDataType: "double"
          DefaultValue: []
             Sublabels: [1x1 signalLabelDefinition]
                   Tag: ""
           Description: "Regions where trills occur"

 Use labeledSignalSet to create a labeled signal set.

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

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: getLabelDefinitions(lss,LabelType="roiFeature",FrameSize=50,FrameOverlapLength=5) returns signalLabelDefinition objects that contain roiFeature labels which have a frame size equal to 50 and a frame overlap length equal to 5.

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.

When you specify a frame overlap length, the function returns signalLabelDefinition objects that contain roiFeature labels that have FrameSize and FrameOverlapLength equal to the values you specify.

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.

When you specify a frame rate, the function returns signalLabelDefinition objects that contain roiFeature labels that have FrameSize and FrameRate equal to the values you specify.

Example: LabelType="roiFeature",FrameSize=50,FrameRate=45

Data Types: double

Output Arguments

collapse all

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

Version History

Introduced in R2018b