Main Content

getLabelValues

Get label values from labeled signal set

Description

example

val= getLabelValues(lss)returns a table containing the label values for all members of the labeled signal setlss.

val= getLabelValues(lss,midx)returns a table containing the label values for the member specified bymidx.

[val,sublbltbl] = getLabelValues(lss,midx,lblname)returns the value of the label namedlblname. Iflblnamehas sublabels, then the tablesublbltblshows the structure of the label value and its sublabel variables.

[___] = getLabelValues(___,'LabelRowIndex',ridx)specifies the row index,ridx, of an ROI or point label whose value you want to get.

[___] = getLabelValues(___,'SublabelRowIndex',sridx)specifies the row index,sridx, of an ROI or point sublabel whose value you want to get.

Examples

collapse all

Load a labeled signal set containing recordings of whale songs.

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

Get the values of the labels.

lbls = getLabelValues(lss)
lbls=2×3 tableWhaleType MoanRegions TrillRegions _________ ___________ ____________ Member{1} blue {3x2 table} {1x3 table} Member{2} blue {3x2 table} {1x3 table}

Display the moan ROI limits for the second signal of the set.

lbb = getLabelValues(lss,2,'MoanRegions')
lbb=3×2 tableROILimits Value ____________ _____ 2.5 3.5 {[1]} 5.8 8 {[1]} 15.4 16.7 {[1]}

Plot the trill region of the signal between the ROI limits. Display the labeled trill peaks.

tvals = getLabelValues(lss,2,'TrillRegions'); peaks = getLabelValues(lss,2,{'TrillRegions','TrillPeaks'}); sg = getSignal(lss,2); plot((0:length(sg)-1)/lss.SampleRate,sg) xlim(tvals.ROILimits) holdonplot(peaks.Location,cell2mat(peaks.Value),'v') holdoff

Figure contains an axes object. The axes object contains 2 objects of type line.

Display the coordinates of the third trill peak.

pcoor = getLabelValues(lss,2,{'TrillRegions','TrillPeaks'},...'LabelRowIndex', 1'SublabelRowIndex',3)
pcoor=1×2 tableLocation Value ________ __________ 11.437 {[0.1500]}

Input Arguments

collapse all

Labeled signal set, specified as alabeledSignalSetobject.

Example:labeledSignalSet({randn(100,1) randn(10,1)},signalLabelDefinition('female'))指定了一个带两组random signals containing the attribute'female'.

Member row number, specified as a positive integer.midxspecifies the member row number as it appears in theLabelstable 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 inlblnameand the sublabel is of type ROI or point.

Output Arguments

collapse all

Label values, returned as a table.

Sublabel values, returned as a table showing the structure of the label value and its sublabel variables.

  • Iflblnamehas no sublabels, thensublbltblis empty.

  • If you specifylblnameas a string or cell array, thensublbltblis empty.

Version History

Introduced in R2018b