Main Content

removePointValue

Remove row from point label

Description

example

removePointValue(lss,midx,lblname) removes all rows of the point label lblname for the member specified by midx.

  • If lblname is a character vector or a string scalar, the function targets a parent label.

  • If lblname is a two-element string array or a two-element cell array of character vectors, the function:

    • Interprets the first element as the name of a parent label.

    • Interprets the second element as the sublabel name of a point label.

    • Removes all the points of the sublabel.

removePointValue(lss,midx,lblname,'LabelRowIndex',ridx) removes a row, specified by ridx, of the point label lblname for the member midx.

If lblname is a two-element string array or a two-element cell array of character vectors, the function:

  • Interprets the first element as the name of a parent label.

  • Interprets the second element as the sublabel name of a point label.

  • Removes all the point of the sublabel contained in row ridx.

removePointValue(lss,midx,lblname,'SublabelRowIndex',sridx) removes the sublabel row specified by sridx. In this case, lblname must be a two-element string array or a two-element cell array of character vectors:

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

  • The second element is the sublabel name of a point label.

removePointValue(lss,midx,lblname,'LabelRowIndex',ridx,'SublabelRowIndex',sridx) removes the sublabel row specified by sridx of the ROI or point label row specified by ridx. In this case, lblname must be a two-element string array or a two-element cell array of character vectors:

  • The first element is the name of a parent ROI or point label.

  • The second element is the sublabel name of a point label.

Examples

collapse all

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

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.

nm = lss.NumMembers;

Define a point label associated with the signal maximum.

themax = signalLabelDefinition('Maximum','LabelType','point', ...
    'LabelDataType','numeric')
themax = 
  signalLabelDefinition with properties:

                      Name: "Maximum"
                 LabelType: "point"
             LabelDataType: "numeric"
        ValidationFunction: []
    PointLocationsDataType: "double"
              DefaultValue: []
                 Sublabels: [0x0 signalLabelDefinition]
                       Tag: ""
               Description: ""

 Use labeledSignalSet to create a labeled signal set.
addLabelDefinitions(lss,themax)

Find the maxima of the signals and add their values to the labeled set.

figure
for idx = 1:nm
    sg = getSignal(lss,idx);
    [mx,ix] = max(sg);
    setLabelValue(lss,idx,'Maximum',ix,mx)
    
    subplot(nm,1,idx)
    plot((0:length(sg)-1)/lss.SampleRate,sg,ix/lss.SampleRate,mx,'*')
end

Verify that the set includes the new point label.

getLabelValues(lss)
ans=2×4 table
                 WhaleType    MoanRegions    TrillRegions      Maximum  
                 _________    ___________    ____________    ___________

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

Remove the 'Maximum' value for the first member of the set. Verify that the label is empty for the first member.

removePointValue(lss,1,'Maximum')

getLabelValues(lss,1)
ans=1×4 table
                 WhaleType    MoanRegions    TrillRegions      Maximum  
                 _________    ___________    ____________    ___________

    Member{1}      blue       {3x2 table}    {1x3 table}     {0x2 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.

Sublabel row index, specified as a positive integer. This argument applies only when a label and sublabel pair has been specified in lblname and the sublabel is of type ROI or point.

Introduced in R2018b