%% Merge Labeled Signal 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)
labelDefinitionsSummary(lss)

%
% 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)

% 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)

% 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)
labelDefinitionsSummary(lssmerge)

% Copyright 2019 The MathWorks, Inc.