%% Add Label Definition
% Load a labeled signal set containing recordings of whale songs.

load whales
lss

%
% Create a label definition that specifies whether a signal corresponds to a calf or to an adult whale.

calf = signalLabelDefinition('Calf','LabeldataType','logical','DefaultValue',false, ...
    'Description','Is the specimen a calf, or an adult?')

% Add the definition to the labeled signal set. Retrieve the names of the labels.

addLabelDefinitions(lss,calf)

getLabelNames(lss)

%
% Create a label definition that specifies the sex of the whale. Add the label to the set as a sublabel of 'WhaleType'.

sx = signalLabelDefinition('Sex','LabelDataType','categorical', ...
    'Categories',["male" "female"]);
addLabelDefinitions(lss,sx,'WhaleType')

labelDefinitionsHierarchy(lss)

% Copyright 2018 The MathWorks, Inc.