getLabeledSignal

Get labeled signals from labeled signal set

Description

example

[t,info] = getLabeledSignal(lss) returns a table with all the signals and labeled data in the labeled signal set lss.

[t,info] = getLabeledSignal(lss,midx) returns a table with the signals specified in midx.

Examples

collapse all

Load a labeled signal set containing recordings of whale songs.

load whales
lss
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 a table with all the signals in lss.

t = getLabeledSignal(lss)
t=2×4 table
                      Signal         WhaleType    MoanRegions    TrillRegions
                 ________________    _________    ___________    ____________

    Member{1}    {79572x1 double}      blue       {3x2 table}    {1x3 table} 
    Member{2}    {76579x1 double}      blue       {3x2 table}    {1x3 table} 

Identify the sublabels of the trill regions.

d = getLabelNames(lss,'TrillRegions')
d = 
"TrillPeaks"

Get the labeled signal corresponding to the second member of the set.

[lbs,info] = getLabeledSignal(lss,2)
lbs=1×4 table
                      Signal         WhaleType    MoanRegions    TrillRegions
                 ________________    _________    ___________    ____________

    Member{2}    {76579x1 double}      blue       {3x2 table}    {1x3 table} 

info = struct with fields:
    TimeInformation: "sampleRate"
         SampleRate: 4000

Extract the signal. Determine its sample rate and use the sample rate to compute the time vector.

fs = info.SampleRate;
sg = getSignal(lss,2);
t = (0:length(sg)-1)/fs;

Identify the moan and trill regions of interest and the peaks of the trill region.

mvals = getLabelValues(lss,2,'MoanRegions');
tvals = getLabelValues(lss,2,'TrillRegions');

peaks = getLabelValues(lss,2,{'TrillRegions','TrillPeaks'});

Plot the signal. Highlight the regions of interest and the peaks.

plot(t,sg)

hold on
[X,Y] = meshgrid([mvals.ROILimits;tvals.ROILimits],ylim);
plot(X,Y,':k')
topts = {'HorizontalAlignment','center','FontWeight','bold', ...
    'FontSize',12,'Color',[139 69 19]/255};
text((X(1,1:4)+X(1,5:end))/2,Y(2,5:end)-0.1, ...
    ["moan" "moan" "moan" "trill"],topts{:})
hold off

Input Arguments

collapse all

Labeled signal set, specified as a labeledSignalSet object.

Example: labeledSignalSet({randn(100,1) randn(10,1)},signalLabelDefinition('female')) specifies a two-member set of random signals containing the attribute 'female'.

Member row number, specified as a positive integer. midx specifies the member row number as it appears in the Labels table of a labeled signal set.

Output Arguments

collapse all

Labeled signal, specified as a table.

Time information, returned as a structure.

Introduced in R2018b