File Exchange

image thumbnail


version 1.04.1 (10 MB) by Marcus Vollmer
A user friendly application for screening and manipulation of ECG data and the analysis of heart rate variability.


Updated 18 Feb 2020

GitHub view license on GitHub

# HRVTool v1.04
## Methods for analyzing Heart Rate Variability

The present functions are originally made for Matlab R2015a. Errors may occur using older releases (at least R2014b required). Additional toolboxes are not required to run the basic analysis. The Image Processing Toolbox is recommended and required to use the 'picker'-functionality.

**HRV.m** is a Matlab class containing function for analyzing HRV.
**HRVTool.m** contains the code to start the GUI (Graphical User Interface) on Matlab.
**HRVTool.mlappinstall** is the app package which can be installed with Matlab.

Please run HRVTool.m to start the GUI or click on the icon in the App menu of Matlab.
The user interface has been tested on Windows 7 64bit, Linux Ubuntu 18.04 and Mac OS 10.13.6.

### Supported file types
- [x] HRM - Polar files
- [x] MAT - Matlab files containing waveforms or RR intervals (in ms)
- [x] TXT - text files containing waveforms or RR intervals (in ms)
- [x] ECG - PhysioNet files (PhysioNet wfdb toolbox required)
- [x] WAV - Hexoskin files
- [x] EDF - European Data Format
- [x] ACQ - BIOPAC data (Source code of Jimmy Shen)
- [x] ISHNE - Holter Standard Format (ECG and annotation data)
- [x] MIBF - Machine Independent Beat file (GE Marquette holter format)

Other formats are possible to integrate. Please address your wishes to

Supporting files to load BIOPAC ACQ data (load_acq.m, acq2mat.m) are licensed by Jimmy Shen given the copyright notice LICENSE_ACQ.
Copyright (c) 2009, Jimmy Shen
All other supported files and functions are licensed under the terms of the MIT License (MIT) given in LICENSE and LICENSE_ICONS
Copyright (c) 2015-2019 Marcus Vollmer

01 September 2019

Cite As

Vollmer, Marcus. “HRVTool - an Open-Source Matlab Toolbox for Analyzing Heart Rate Variability.” 2019 Computing in Cardiology Conference (CinC), Computing in Cardiology, 2019, doi:10.22489/cinc.2019.032.

View more styles

Vollmer, Marcus. “A Robust, Simple and Reliable Measure of Heart Rate Variability Using Relative RR Intervals.” 2015 Computing in Cardiology Conference (CinC), IEEE, 2015, doi:10.1109/cic.2015.7410984.

View more styles

Comments and Ratings (38)

Dear Pierre,

I'm sorry that you cannot use this functionality. Here I'm making use of getpts to extract the coordinates when you are clicking. This function comes with the Image Processing Toolbox (IPT).

There are ways to solve your at least your visibility problem without making use of IPT:
You can either add this line to your settings file:
vis = [true true true false false false false];
or you edit line 285 and line 1084 in HRVTool.m.

Concerning your second question about the missing LH/HF measure, I'm not quite sure what you mean with 'extracted variables'. But I assume, that your RR intervals contains NANs, which prevents from the computation of the power spectrum.


Particularly, the selection "Remove Artifact not permite to select one artifact with cursor" and it's the same concerning the visualisation ON/OFF and the selection of variables

Hey! Thank you so much for all your help, I really appreciate it. Is it normal that I don't have the same options on the interface as those on your tutorial. When I click on visibility on/off I can't remove the variables to view only the ones I'm interested in.

Then, I wanted to know if it was normal that my extracted variable does not show me the LH, HF and the LH/HF ratio, would it be because I have a free version under 30 days of mathlab?

Last question, how can I make my results after exporting them show the ApEn (Entropy) and all the other possible variables.

Thank you for your attention,


Dear Guillaume,

The tool detects exceptional RR intervals and replaces the value to NaN to exclude this information from HRV calculations.
I recommend not interpolating the normal heart rhythm. By doing so you assume to already know about the heart rate variability pattern, but normally this is, want you are going to assess from the data. FFT-based methods such as HF/LF cannot handle missingness in the interval information without data manipulation and making assumptions as described above. I therefore recommend to use other robust measures for HRV.


I new in the domain of HRV.
Your tool can correct ectopic beat ? Like linear interpolation or anything else ?
How can i have HF/LF ratio with a NAN ?
Please help me.

Dear Eddie,

Welcome in Matlab. To make use of PhysioNet data in Matlab you should download the WFDB Toolbox. Go to and follow the instructions as given under 'Quick Start'.


i am new to matlab, how do i upload ECG data from Physionet to matlab

please help


Paul Beach

sorry - disregard the last post. It started working!

Dear Gabriel,

I'm not sure, which HR monitor from Polar you are using. But you need an export file containing inter-beat intervals. Please write me an e-mail, if you are still stuck in the analysis.


Hello Marcus,
I downloaded some data from my polar heart rate monitor but am unable to process it on your application in matlab. i converted the file to txt but the app keeps asking me if i want to add meta data from hrm-file which I don't. If i clicked no, the process failed. can you please help me out. Thank you.

Dear Josh,

please save the waveform column separately from the time column as a single columned csv. Import the csv file and fill the dialog window with the file type "waveform" set the sampling frequency to "500" Hz. The time difference is also 0.002 sec for a 512 Hz ECG, so please check the real frequency. Try 'format long' in Matlab.


Hi Marcus,

I am trying to get import a CSV file straight from an oscilloscope and have not met with any success so far. The CSV file essentially contains two columns, one with time in 0.002 second increments, and the other with voltage variation from the oscilloscope within a range from -4 to 4 volts. Any ideas as to what I need to do?

Dear Scott,

First of all please select the appropriate file extension using the the drop down menu, which is a bit hidden on MacOS. Then all files matching the file extension will be listed and can be selected for the import of your data.


Hi Marcus.

I have just installed the app into matlab. It doesn't seem to recognize any files, either .mat or .csv as files that can be opened. The demo functions just find. I can't seem to add any of my won data however. Any idea whats up? This is 2016b on a mac

Dear Dario,

Thank you for your question.
For heart beat detection the toolbox uses a minor changed algorithm which I have published and presented at Computing in Cardiology 2014 ( The annotation are made on the basis of the largest range of the input signal in a windowed approach. These annotations can differ from the R peaks e.g. in such cases when the S peaks are deeper than the baseline. If you are interested in the R peak you can easily adjust the calculated annotations while searching for the highest peak nearby, e.g. in the range of +/- 10 samples:
for i=1:size(Ann,1)
[~,locECG] = max(ECG(Ann(i)+[-10:10]));
Ann(i) = Ann(i)+locECG-11;

In a future release it planned that you can select from various heart beat detectors and some functions will be added that you can easily adjust the annotations.

Best regards,

Hi Marcus and thanks for sharing your work.
I am opening a .mat file with the waveform (fVals) and the HRVTool detects the heart beats and I save the Annotation .mat (Ann). However, If I load fVals.mat with the waveform, plot it and then plot the Ann file, the peaks are not exactly on the waveform peaks (even when the .mat file used is a file created from inside the HRVTool, save sig_waveform). Actually there is sometimes several samples difference.
I want to make sure that the peaks in the waveform signal are indeed the ones in the Ann file and it appears they are not.
Is there any processing that I am missing??
Thanks again for sharing


Dear Marcus,
I update my version of Matlab R2015a to R2016b and it worked.
Apparently it was a problem of how Matlab handled the "folder" field.

Dear Ivan,

I'm sorry for that. When starting the app it will search for the installation path to read the example data. On Linux the search for the app path should work with the new commands I introduced recently. Please try the new version 1.02.

Kind regards,

Dear Marcus,
I can't open the app, the following error occurs, do you have some suggestion?

Reference to non-existent field 'folder'.

Error in HRVTool (line 28)
AppPath = FileList.folder;

Error in HRVToolApp/startApp (line 59)

Error in HRVToolApp (line 38)

Error in appinstall.internal.runapp>execute (line 79)
out = evalin('caller', [script ';']);

Error in appinstall.internal.runapp1runapp13a (line 58)
outobj = execute(fullfile(appinstalldir, [wrapperfile 'App.m']));

Error in appinstall.internal.runapp>runcorrectversion (line 35)
appobj = runapp13a(appinstalldir);

Error in appinstall.internal.runapp (line 17)
out = runcorrectversion(appmetadata, appentrypoint, appinstalldir);

Jay Alan

Dear Marcus,
Thank you so very much for your inputs. Thanks to it, have been able to use it.
Please keep up the great work!

Dear Jay,

I'm sorry for that error, which is caused by a false path to the app folder appearing in 'HRV_settings.m'. Please delete that file in your HRVTool app path. HRVTool will then initialize the settings file when restarting HRVTool, reading your personalized app path in Matlab (depending on your operating system).
Another way is the re-installation of HRVTool, which is now updated.


Jay Alan

Jay Alan

Dear Marcus,
Installed HRV App in R2018a on Mac running OS X version 10.9.5 (without any issues)
When I start the App, the window does not load the example; a lot of errors appear on the command window (copy-pasted below). Any pointers would be greatly appreciated. Thanks in advance.
> In HRVTool/calc_on (line 1711)
In HRVTool/buttonStart_Callback (line 591)
In HRVTool (line 585)
In HRVToolApp/startApp (line 88)
In HRVToolApp (line 48)
In appinstall.internal.runapp>execute (line 86)
In appinstall.internal.runapp>runapp13a (line 65)
In appinstall.internal.runapp>runcorrectversion (line 44)
In appinstall.internal.runapp (line 19)
Unable to perform assignment with 0 elements on the right-hand side.

Error in HRVTool/buttonStart_Callback (line 596)
FileName = STR{VAL};

Error in HRVTool (line 585)

Error in HRVToolApp/startApp (line 88)

Error in HRVToolApp (line 48)

Error in appinstall.internal.runapp>execute (line 86)
out = evalin('caller', [script ';']);

Error in appinstall.internal.runapp>runapp13a (line 65)
outobj = execute(fullfile(appinstalldir, [wrapperfile 'App.m']));

Error in appinstall.internal.runapp>runcorrectversion (line 44)
appobj = runapp13a(appinstalldir);

Error in appinstall.internal.runapp (line 19)
runcorrectversion(appmetadata, appentrypoint, addonmetadatadir);

Warning: 'popupmenu' control requires a scalar Value.
Control will not be rendered until all of its parameter values are valid

Dear Varun,
you can save the HRV measures calculated for the global, local and footprint range by clicking on 'File' > 'Save As' and selecting 'mat' or 'csv' as the export format. For a detailed analysis on a segmentwise basis I suggest the use the functions in the HRV.m class.

how to export the results?

Dear Achilleas,

please have a look at my read_edf function:

There is a way of interactively select on of the channels stored in the edf or to import all signals along with the header information, which are stored in a structure.


How do you read edf files?

Soufia dani

could you please share with me your (*.fig) or just explain me how can i regenerate it form file(*.m) becouse really i need it so much.

Soufia dani

Hi every one i am here to ask you please i wanna knew if are there any possibility to modifiy this app just from it is GUI because i try to add some buton but i cant do it just from GUI i have to come back to the code if i want to change,

Dear Balu Krishnan,

It sounds to me, that Matlab fails to read the app path to HRVTool. I cannot identify the problem but I assume a reading/writing permission error. Please try to execute the code "HRVTool.m" without reading the app path. To get this running comment lines 21-30 and uncomment line 33. Make sure that you have copied all required files into your working directory and the toolbox should appear.


I tried installing the app in Matlab v2017a and it is taking forever to install the app. When I tried executing the code (HRV_tool), the code does not execute. I tried debugging and it stops at line 22 (files = matlab.apputil.getInstalledAppInfo;). I assume this is some issue with the way the app is getting installed in 2017a. Do you know about any compatibility issue with new versions of matlab?

Dear Gang Chen,
Please make sure that you are using a Matlab version of at least R2014b. Please uninstall the toolbox and make sure that the corresponding folder in the application path was completely removed before you install the new version of HRVTool (v0.98). In case of further error please contact me via email.


gang chen

Thank you for your toolbox, but i can't import my data by the GUI.
when i star the GUI, the following mistake message will be display:
error HRVTool (line 500)
F.htoolbar = findall(F.fh,'tag','FigureToolBar');

Dear Rafael,

please comment the lines 22-24 in HRVTool.m or install the equivalent Matlab-App from


Rafael J.

Thanks for posting this toolbox. It looks very powerful. You say it can load waveforms, so can it load in a raw ECG signal?

I try to run the GUI by typing in HRVTool but am receiving the following error:

Index exceeds matrix dimensions.

Error in HRVTool (line 23)
[path,~,~] = fileparts(files(1).location);

I am running this in Matlab 2015b. Thanks in advance.



Citation notes updated


EDF import function improved to save memory. Saving of pdf-screenshots with resolution selection and printer friendly light colors. MIB/MIBF files from GE Marquette holter devices (Machine Independent Beat file, '*.mib', '*.mibf') supported.


Editing annotations (align all or local beats to negative or positive peaks). Buttons: show/hide annotations, normalize the waveform, font size. Animation of waveform data. Selection of a color scheme (dark mode). Automated resizing of fonts.


Bug resolved when searching for the app path.


Added functionality for editing/saving annotations (add, remove and ignore beats). Support of ISHNE Holter Standard Format ('*.ecg', '*.ann'). Selection of beat types when importing PhysioNet and ISHNE annotation files. Simplified search for AppPath.


BIOPAC ACQ files supported.

Ability to read the '*.edf' files - the European Data Format - a standard format for medical time series. Corrected calculation for Approximate Entropy ApEn in the HRV.m class.

You are now able to read the '*.csv' files with a comma as a decimal mark. Resolved some bugs in reading the application path and in the path of '*.wav' files.

You are now able to read the ECG from '*.wav' files which are generated from Hexoskin products using the binary file export

Additional toolboxes are not required any more

You are also able to install the latest MatlabApp from

MATLAB Release Compatibility
Created with R2019a
Compatible with R2014b to any release
Platform Compatibility
Windows macOS Linux