File Exchange

image thumbnail

MarcusVollmer/HRV

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

54 Downloads

Updated 01 Sep 2019

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 marcus.vollmer@uni-greifswald.de

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

Marcus Vollmer (2019). MarcusVollmer/HRV (https://www.github.com/MarcusVollmer/HRV), GitHub. Retrieved .

Marcus Vollmer (2015). A robust, simple and reliable measure of heart rate variability using relative RR intervals, 2015 Computing in Cardiology Conference (CinC), IEEE, 609-612.

Comments and Ratings (29)

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.

Best,
Marcus

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.
Gabriel

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.

Best,
Marcus

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.

Best,
Marcus

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 (http://www.cinc.org/archives/2014/pdf/0569.pdf). 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;
end

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,
Marcus

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

Dario

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,
Marcus

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)
eval('HRVTool');

Error in HRVToolApp (line 38)
startApp(obj)

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!
Regards,
Jay

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.

Best,
Marcus

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

Error in HRVToolApp/startApp (line 88)
eval('HRVTool');

Error in HRVToolApp (line 48)
startApp(obj)

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.
Best,
Marcus

how to export the results?

Dear Achilleas,

please have a look at my read_edf function:
https://github.com/MarcusVollmer/HRV/blob/master/read_edf.m

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.

Best,
Marcus

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.
thanks

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.

Best,
Marcus

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.

Best,
Marcus

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 http://marcusvollmer.github.io/HRV/

Best
Marcus

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.

Updates

1.04

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.

1.03

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.

1.02

Bug resolved when searching for the app path.

1.01

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.

1.00.1

BIOPAC ACQ files supported.

1.0.0.0

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.

1.0.0.0

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.

1.0.0.0

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

1.0.0.0

Additional toolboxes are not required any more

1.0.0.0

You are also able to install the latest MatlabApp from http://marcusvollmer.github.io/HRV/

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