Software for Matlab and Octave

The new PhysioNet website is available at: We welcome your feedback.

This directory contains software, mostly contributed by PhysioNet users, for use with Matlab and Octave. Matlab is a popular commercial program that provides an interactive environment for numeric computation and graphics using an interpreted programming language that optionally can be compiled. Octave is a freely available open-source program that is compatible with Matlab. Both Octave and Matlab can run under most popular operating systems, including GNU/Linux, Mac OS X, MS-Windows, and many versions of Unix. Sources for Octave are available here and from the official Octave web site.

Reading and writing PhysioBank and compatible data

PhysioBank data are stored in a variety of formats ("WFDB-compatible formats") that can be read and written using the WFDB library, which is written in C and can be called directly from user-written applications written in C, C++, or Fortran. Digitized signals (waveforms) are most often stored in "format 212", in which pairs of 12-bit samples are bit-packed into three 8-bit bytes. The library can read and write signal files in many other WFDB-compatible formats, and a few of these formats are used for PhysioBank data that cannot be stored in format 212. Although the WFDB library also supports multiple annotation formats, only one of these is used for PhysioBank annotation files, which are binary files containing variable-length annotations averaging slightly over 2 bytes each.

Software available here offers several ways of reading and writing WFDB-compatible files from Matlab, with varying levels of effort required:

  1. The WFDB Toolbox for Matlab: This toolbox is a collection of MATLAB functions for reading, writing, and manipulating (processing) PhysioBank data. The functions are implemented as system calls through MATLAB and Java wrappers to native binary executables based on the WFDB Software Package, so they support reading data directly from the PhysioNet web site (using HTTP) as well as from local disk files. The toolbox can be installed from within MATLAB. It runs on 64-bit GNU/Linux, Mac OS X, or MS-Windows, and it requires Matlab 7.11 (R2010b) or later, with a working Java Virtual Machine (JVM) that supports Java 1.6 or later. It is not currently usable on any 32-bit platform, on Solaris, with Octave, or with earlier versions of Matlab or Java.

  2. The PhysioBank ATM: Use the ATM in your web browser to locate and visualize PhysioBank data of interest, then use its Export signals as .mat tool to create .mat files that you can download and read directly in any version of Matlab or Octave. If you also save the short .info file generated by the tool, the function plotATM (in either Matlab or Octave) can read the .mat file, baseline-correct and scale the signals in it, and plot them. The segments that can be obtained from the ATM are limited to 1 million samples per signal in length.

  3. wfdb2mat: This application, which is part of the WFDB Software Package, is used by the ATM's Export signals as .mat tool, but you can also run it on your own computer, with no restriction on segment length. If the original signal files have not been downloaded from PhysioNet, wfdb2mat can read them directly from the PhysioNet server. (The .mat files generated by wfdb2mat, when accompanied by the .hea files generated at the same time, are also directly readable by dozens of other applications in the WFDB Software Package, including WAVE.)

  4. Converting annotations to text: You can do this using the Show annotations as text tool in the PhysioBank ATM, or you can use rdann to do this on your own computer once you have installed the WFDB Software Package. The text contains one annotation per line, and can be easily parsed in any version of Matlab or Octave.

The older methods listed below also remain available:

All of the methods above use the WFDB library to read or write PhysioBank and compatible records. The advantages of doing so are that they can be updated to handle new file formats simply by updating the WFDB library, they are highly efficient, and they can read data directly from PhysioNet as well as from local files. Several users contributed software that does not use the WFDB library, but can read local disk copies of signal files in format 212 or in PhysioBank annotation file format:

Other PhysioToolkit software for Matlab and Octave

The directory ECGwaveGen contains software contributed by Floyd Harriott for generating a synthesized ECG-like test signal.

A Matlab/Octave implementation of ECGSYN, which generates realistic ECGs, has been contributed by Patrick McSharry and Gari Clifford.

A Matlab/Octave implementation of ecgpuwave, which locates P, QRS, and T wave onsets, peaks, and ends in ECG signals, has been contributed by the authors of the original Fortran 77 implementation.

For an example of a large Matlab application that works together with C-language software from the WFDB Software Package, see RCVSIM, contributed by Ramakrishna Mukkamala.

Matlab code for calculating sample entropy (SampEn) has been contributed by Doug Lake, Randall Moorman, and Cao Hanqing, and is available here.

We thank the authors for these generous contributions to PhysioToolkit. If you find these programs useful, please send us a note (or write to the contributors directly).

Icon  Name                    Last modified      Size  Description
[PARENTDIR] Parent Directory - [DIR] ECG_Exporter/ 2005-05-17 15:34 - [DIR] ECGwaveGen/ 2012-01-05 20:46 - [DIR] wfdb-app-matlab/ 2018-10-31 16:11 - [DIR] wfdb-subset/ 2012-01-05 20:46 - [DIR] wfdb-swig-matlab/ 2016-10-19 17:11 - [DIR] wfdb_tools/ 2012-01-05 20:46 - [TXT] plotATM-1.0.m 2009-12-11 11:39 1.8K Matlab/Octave source [TXT] plotATM.m 2014-01-31 10:53 1.9K Matlab/Octave source [TXT] rddata.m 2003-02-28 09:10 5.3K Matlab/Octave source [   ] WFDB_tools.tar.gz 2006-04-29 22:35 393K gzip-compressed tar archive

Questions and Comments

If you would like help understanding, using, or downloading content, please see our Frequently Asked Questions.

If you have any comments, feedback, or particular questions regarding this page, please send them to the webmaster.

Comments and issues can also be raised on PhysioNet's GitHub page.

Updated Friday, 28 October 2016 at 16:58 EDT

PhysioNet is supported by the National Institute of General Medical Sciences (NIGMS) and the National Institute of Biomedical Imaging and Bioengineering (NIBIB) under NIH grant number 2R01GM104987-09.