merge
Merge two or more labeled signal sets
Description
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.
Examples
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?"
Input Arguments
Input labeled signal sets, specified as labeledSignalSet
objects.
All input sets must have the same time information settings and data source type.
Output Arguments
Merged 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.
Version History
Introduced in R2020a
See Also
MATLAB Command
You clicked a link that corresponds to this MATLAB command:
Run the command by entering it in the MATLAB Command Window. Web browsers do not support MATLAB commands.
Sélectionner un site web
Choisissez un site web pour accéder au contenu traduit dans votre langue (lorsqu'il est disponible) et voir les événements et les offres locales. D’après votre position, nous vous recommandons de sélectionner la région suivante : .
Vous pouvez également sélectionner un site web dans la liste suivante :
Comment optimiser les performances du site
Pour optimiser les performances du site, sélectionnez la région Chine (en chinois ou en anglais). Les sites de MathWorks pour les autres pays ne sont pas optimisés pour les visites provenant de votre région.
Amériques
- América Latina (Español)
- Canada (English)
- United States (English)
Europe
- Belgium (English)
- Denmark (English)
- Deutschland (Deutsch)
- España (Español)
- Finland (English)
- France (Français)
- Ireland (English)
- Italia (Italiano)
- Luxembourg (English)
- Netherlands (English)
- Norway (English)
- Österreich (Deutsch)
- Portugal (English)
- Sweden (English)
- Switzerland
- United Kingdom (English)