Merge two or more labeled signal sets
merges N labeled signal set objects, lssnew
= merge(lss1,...,lssN
)lss1,...,lssN
,
and returns a labeled signal set lssnew
containing all the members and
label values of the input sets.
Load a labeled signal set containing recordings of whale songs. Display the names of the set's members and a summary of its label definitions.
load whales
getMemberNames(lss)
ans = 2×1 string
"Member{1}"
"Member{2}"
labelDefinitionsSummary(lss)
ans=3×9 table
LabelName LabelType LabelDataType Categories ValidationFunction DefaultValue Sublabels Tag Description
______________ ___________ _____________ ____________ __________________ ____________ ___________________________ ___ ____________________________
"WhaleType" "attribute" "categorical" {3×1 string} {["N/A" ]} {0×0 double} {0×0 double } "" "Whale type"
"MoanRegions" "roi" "logical" {["N/A" ]} {0×0 double} {0×0 double} {0×0 double } "" "Regions where moans occur"
"TrillRegions" "roi" "logical" {["N/A" ]} {0×0 double} {0×0 double} {1×1 signalLabelDefinition} "" "Regions where trills occur"
Create a new signal set with the same data source, time information, and labels as lss
. Remove the first member of the new set and change the name of the remaining one. Display the names of the new set's members.
newlss = copy(lss);
removeMembers(newlss,1)
setMemberNames(newlss,"YoungOne")
getMemberNames(newlss)
ans = "YoungOne"
Create a label definition that specifies whether a signal corresponds to a calf or to an adult whale. Add the definition to the new labeled signal set and label the member. Remove the label that specifies the moan regions. Display a summary of the new member's label definitions
calf = signalLabelDefinition('Calf','LabeldataType','logical','DefaultValue',false, ... 'Description','Is the specimen a calf, or an adult?'); addLabelDefinitions(newlss,calf) setLabelValue(newlss,1,"Calf",true) removeLabelDefinition(newlss,"MoanRegions") labelDefinitionsSummary(newlss)
ans=3×9 table
LabelName LabelType LabelDataType Categories ValidationFunction DefaultValue Sublabels Tag Description
______________ ___________ _____________ ____________ __________________ ____________ ___________________________ ___ ______________________________________
"WhaleType" "attribute" "categorical" {3×1 string} {["N/A" ]} {0×0 double} {0×0 double } "" "Whale type"
"TrillRegions" "roi" "logical" {["N/A" ]} {0×0 double} {0×0 double} {1×1 signalLabelDefinition} "" "Regions where trills occur"
"Calf" "attribute" "logical" {["N/A" ]} {0×0 double} {[ 0]} {0×0 double } "" "Is the specimen a calf, or an adult?"
Merge the two labeled signal sets. Verify that the merged set contains the members, definitions, and labels of the original sets.
lssmerge = merge(lss,newlss); getMemberNames(lssmerge)
ans = 3×1 string
"Member{1}"
"Member{2}"
"YoungOne"
labelDefinitionsSummary(lssmerge)
ans=4×9 table
LabelName LabelType LabelDataType Categories ValidationFunction DefaultValue Sublabels Tag Description
______________ ___________ _____________ ____________ __________________ ____________ ___________________________ ___ ______________________________________
"WhaleType" "attribute" "categorical" {3×1 string} {["N/A" ]} {0×0 double} {0×0 double } "" "Whale type"
"MoanRegions" "roi" "logical" {["N/A" ]} {0×0 double} {0×0 double} {0×0 double } "" "Regions where moans occur"
"TrillRegions" "roi" "logical" {["N/A" ]} {0×0 double} {0×0 double} {1×1 signalLabelDefinition} "" "Regions where trills occur"
"Calf" "attribute" "logical" {["N/A" ]} {0×0 double} {[ 0]} {0×0 double } "" "Is the specimen a calf, or an adult?"
lss1,...,lssN
— Input labeled signal setslabeledSignalSet
objectsInput labeled signal sets, specified as labeledSignalSet
objects.
All input sets must have the same time information settings and data source type.
lssnew
— Merged labeled signal setlabeledSignalSet
objectMerged labeled signal set, returned as a labeledSignalSet
object.
The set lssnew
contains a signal source, label definitions, and
label values that are independent of those in the input labeled signal sets.
Changing any of the input labeled signal sets does not affect the merged labeled signal set.
Changing the merged labeled signal set does not affect any of the input labeled signal sets.
You have a modified version of this example. Do you want to open this example with your edits?