Main Content

resetLabelValues

Reset labels to default values

Description

resetLabelValues(lss) resets all label values for all members of the labeled signal set lss.

resetLabelValues(lss,midx) resets all label values for the signals in the member specified by midx.

resetLabelValues(lss,midx,lblname) resets the values of label lblname for the signals in the member specified by midx. To reset a sublabel, make lblname a two-element string array or a two-element cell array of character vectors, with the first element containing the parent label name and the second element containing the sublabel name.

By default, the function resets all sublabels of a parent label. To target a sublabel of an ROI or point parent label, specify the parent label row index using ridx.

example

resetLabelValues(___,'LabelRowIndex',ridx) specifies the row index of the ROI or point parent label for which you want to reset a sublabel value.

Examples

collapse all

Load a labeled signal set containing recordings of whale songs. Get the names of the labels.

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.

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

Get the label values corresponding to the trill regions for the second signal in the set.

idx = 2;
getLabelValues(lss,idx,'TrillRegions')
ans=1×2 table
     ROILimits      Value
    ____________    _____

    11.1      13    {[1]}

Reset the values. Verify that 'TrillRegions' becomes an empty array.

resetLabelValues(lss,idx,'TrillRegions')

getLabelValues(lss,idx,'TrillRegions')
ans =

  0x2 empty table

    ROILimits    Value
    _________    _____
getLabelValues(lss,idx)
ans=1×3 table
                 WhaleType    MoanRegions    TrillRegions
                 _________    ___________    ____________

    Member{2}      blue       {3x2 table}    {0x3 table} 

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

Member row number, specified as a positive integer. midx specifies the member row number as it appears in the Labels table of a labeled signal set.

Label or sublabel name. To specify a label, use a character vector or a string scalar. To specify a sublabel, use a two-element cell array of character vectors or a two-element string array:

  • The first element is the name of the parent label.

  • The second element is the name of the sublabel.

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.

Example: {'Asleep' 'REM'} or ["Asleep" "REM"] specifies a region of a signal in which a patient undergoes REM sleep.

Label row index, specified as a positive integer. This argument applies only for ROI and point labels.

Version History

Introduced in R2018b