Main Content


In Signal Labeler, you can monitor labeling progress and inspect statistics about your labels using the Dashboard. You can display different charts to quickly determine how many members are labeled, analyze the distributions of each label, and confirm the data is labeled correctly.

In the Selected Definition section of the toolstrip, select one or more label definitions to display from the Definition Selection drop-down list. A separate tab for each label definition appears containing tabs for each type of chart. The charts in the Dashboard provide:

  • Percentage of members labeled

  • Distribution of label values

  • Distribution of region or point instances across members

  • Distribution of region-of-interest (ROI) label duration values

  • Distribution of point label locations in time

By default, the Dashboard displays the percentage of members labeled and the label value distribution of the selected label definition. You can select additional charts from the Plots gallery based on the type of label definition selected (attribute, ROI, or point label).


  • To close a chart, click on the X of its tab.

  • To close all the charts for a label definition, right-click on the label definition name in its tab and click Close.

  • To change the position of charts shown for a label definition, right-click on any chart or in the label definition tab area and click Sub-Tile to change the layout of charts to Single, Left/Right, or Top/Bottom.

View Labeling Progress

To view your labeling progress, click Dashboard in the toolstrip. By default, the app displays the percentage of members in your data set that have at least one label for the selected label definition.


You can specify the number of ROI or point labels to count for a member in the progress bar. Click on the plot and type a new Threshold value in the toolstrip.

Dashboard progress bar

Inspect Label Distributions

To assess the quality and accuracy of labels in your data set, select a distribution chart from the drop-down menu in the Plots section of the toolstrip.

Label Value Distribution

You can inspect different label value distributions for attribute, ROI, or point label definitions.

  • Categorical, logical, or string — Each slice of the pie chart represents the number of instances of a particular label value for the selected label definition.

  • Numeric — Each bar in the histogram plot represents the number of instances of a particular label value for the selected label definition.

Time Distribution

You can inspect different time distributions for ROI or point label definitions.

  • Categorical, logical, or string — Each central mark in the box plot represents the median ROI duration or point location of a particular label value for the selected label definition. The bottom and top edges of a box indicate the 25th and 75th percentiles, respectively.

  • Numeric — Each bar in the histogram plot represents the number of instances of an ROI duration or a point location of a particular label value for the selected label definition.


Set the number of bins and x-axes limits to better inspect label distributions in a selected histogram plot. Click on the plot and adjust the settings in the Label Distribution section of the toolstrip.

For more information on related distribution charts, see boxplot (Statistics and Machine Learning Toolbox), histogram, or pie.

Example: Label ECG Signals and Track Progress

This example shows how to track your labeling progress and assess the quality of labels with the Dashboard. In this mode, you can quickly determine how many members are labeled and inspect the distributions of label values and durations in your data set. This step facilitates the process of obtaining complete and accurate data sets for machine learning.

Download and Prepare the Data

Use the QTdownload function to download the electrocardiogram (ECG) signals from the publicly available QT database [1] [2] to a new temporary directory folder. The code for this function is at the end of the example.

folder = QTdownload;

Each file contains an ECG signal ecgSignal, a table of region labels signalRegionLabels, and the sample rate variable Fs. All signals have a sample rate of 250 Hz. The region labels correspond to three heartbeat morphologies:

  • P wave

  • QRS complex

  • T wave

Create a signal datastore that points to folder. Specify the signal variable name ecgSignal and the sample rate variable Fs.

sds = signalDatastore(folder,'SignalVariableNames','ecgSignal','SampleRateVariableName','Fs');

Create a subset of the datastore containing the first twenty files. Use this subset as the source for a labeledSignalSet object.

subsds = subset(sds,1:20);
lss = labeledSignalSet(subsds);

Label Regions of Interest

Open the Signal Labeler app and import the labeled signal set from the Workspace. Plot the first signal in the data set. From the Display tab, select the panner and zoom to a smaller region of the signal for better visualization.

From the Labeler tab, define a categorical region-of-interest (ROI) label with P, QRS and T categories. Name the label BeatMorphologies.

Create a custom labeling function labelECGregions to locate and label the three different regions of interest. Code for the custom function appears later in the example. You can save the function in your current folder, on the MATLAB path, or add it in the app by selecting Add Custom Function in the Automate Value gallery. See Custom Labeling Functions for more information.

Select BeatMorphologies in the Label Definitions browser and choose the labelECGregions function from the Automate Value gallery. Select Auto-Label and then Auto-Label and Inspect Plotted. Click Run. From the Display tab, zoom in on a region of the labeled signal and use the panner to navigate through time. If the labeling is satisfactory, click Save Labels to accept the labels and close the Autolabel tab. You can see the labels and their location values in the Labeled Signal Set Browser.

Visualize Labeling Progress and Statistics

Select the Dashboard in the toolstrip of the Labeler tab. The progress bar shows 5% of members are labeled with at least one ROI label. This corresponds to 1/20 members in the data set. The label distribution pie chart shows the number of instances of each category for the selected label definition.

Close the dashboard and continue your labeling. Select Auto-Label and then Auto-Label All Signals to label the next four signals in the list. Check the box next to the signal names you want to label and then click OK.

Select the Dashboard again. The progress bar now shows 25% of members are labeled. Verify the distribution of each category (P, QRS, or T) is as expected. The Label Distribution pie chart shows that each category makes up about a third of all label instances. Select the Time Distribution histogram chart from the Plots gallery to view the average duration of the P and T waves and QRS complexes. The T waves have longer durations than the P waves and QRS complexes.

Click on the progress bar plot and adjust the Threshold in the toolstrip to count only members with at least 5000 labels. Now only three of the five labeled members are included in the count. Adjust the count threshold to better discriminate between labeled and nonlabeled members based on your labeling requirements.

labelECGregions Function:

The labelECGregions function uses a pretrained deep learning network to identify P, QRS and T heartbeat morphologies in ECG signals.

function [labelVals,labelLocs] = labelECGregions(x,t,parentLabelVal,parentLabelLoc,varargin)

labelVals = cell(2,1);
labelLocs = cell(2,1);

if nargin<5
    Fs = 250;
    Fs = varargin{1};

% Download the pretrained networks
netURL = ''; %#ok<*UNRCH>
modelsFolder = fullfile(tempdir,'QTDatabaseECGSegmentationNetworks');
modelsFile = fullfile(modelsFolder,'trainedNetworks.mat');
zipFile = fullfile(tempdir,'');
    if ~exist(modelsFolder,'dir')
    for kj = 1:size(x,2)
        sig = x(:,kj)';
        predTest = classify(rawNet,sig,'MiniBatchSize',50);
        msk = signalMask(predTest);
        msk.SpecifySelectedCategories = true;
        msk.SelectedCategories = find(msk.Categories ~= "n/a");
        labels = roimask(msk);
        labelVals{kj} = labels.Value;
        labelLocs{kj} = labels.ROILimits/Fs;

labelVals = vertcat(labelVals{:});
labelLocs = cell2mat(labelLocs);


QTdownload Function:

You can download the data files from or use the unzip function to create the QTDatabaseECGData folder in your temporary directory with 210 MAT-files in it.

function folder = QTdownload

dataURL = '';
datasetFolder = fullfile(tempdir,'QTDataset');
zipFile = fullfile(tempdir,'');
if ~exist(datasetFolder,'dir')
folder = datasetFolder;



[1] Goldberger, Ary L., Luis A. N. Amaral, Leon Glass, Jeffery M. Hausdorff, Plamen Ch. Ivanov, Roger G. Mark, Joseph E. Mietus, George B. Moody, Chung-Kang Peng, and H. Eugene Stanley. "PhysioBank, PhysioToolkit, and PhysioNet: Components of a New Research Resource for Complex Physiologic Signals." Circulation. Vol. 101, No. 23, 2000, pp. e215–e220. [Circulation Electronic Pages;].

[2] Laguna, Pablo, Roger G. Mark, Ary L. Goldberger, and George B. Moody. "A Database for Evaluation of Algorithms for Measurement of QT and Other Waveform Intervals in the ECG." Computers in Cardiology. Vol.24, 1997, pp. 673–676.

See Also




Related Topics