The WFDB Toolbox for MATLAB

The new PhysioNet website is available at: https://physionet.org. We welcome your feedback.

Quick Start

For Quick installation of the WFDB Toolbox open MATLAB, cd into a temporary directory, and run the following commands:

>> wfdb_url='http://physionet.org/physiotools/matlab/wfdb-swig-matlab/WFDB_Toolbox_0_0_3.zip';
>> [filestr,status] = urlwrite(wfdb_url,'WFDB_Toolbox_0_0_3.zip');
>> unzip('WFDB_Toolbox_0_0_3.zip');
>>wfdb_install; 

Note: After the WFDB_INSTALL script completes sucessfully, it will request you to copy 2 MATLAB path files to MATLAB's standard directory and restart MATLAB. Failure to do so will result in error messages when attempting to use the toolbox functions.

Alternatively, to install the WFDB Toolbox manually download latest version of the toolbox (WFDB_Toolbox_0_0_3.zip) and follow the instructions in README.txt.

What is the WFDB Toolbox for MATLAB?

The WFDB Toolbox for MATLAB is a collection of applications for reading, writing, manipulating, and plotting PhysioBank data, implemented as functions in MATLAB.

Since it's based on the WFDB Software Package, the WFDB Toolbox for MATLAB supports reading data directly from this web site (using HTTP). For example, in MATLAB, one can very simply download and plot a signal:

>> r = rdsamp('mitdb/100', 'maxt', ':10');
>> plot(r(:,1), r(:,2));

At the moment, the following functions are implemented:

rdann read annotation files for WFDB records
rdsamp read signal files of WFDB records
setwfdb set WFDB paths to default values
time2sec convert WFDB-format time intervals into seconds
wfdb_config return version and compilation information about the WFDB library
wfdbdesc return specifications for signals in WFDB records
wfdbwhich find the location of files belonging to WFDB records
wrann write annotations for WFDB records into annotation files
wrsamp write signal data into WFDB-compatible records

These functions provide MATLAB interfaces to some of the most useful stand-alone (command-line) WFDB applications, which are more fully documented here. Many, but not all, of the features of the stand-alone applications are accessible via these Toolbox functions.

Notes about implementation

The WFDB Toolbox for MATLAB makes use of the compiled WFDB library itself. This means that separate shared libraries are distributed for each supported platform (operating system and CPU).

The Java Native Interface, or JNI, is used to create bindings to the WFDB library from Java code: system-independent Java code implements the WFDB Toolbox, and it makes use of the native WFDB library through JNI.

SWIG is used to create bindings for the WFDB library automatically: it creates a thin layer of code, using JNI, to interface with WFDB.

To use the WFDB Toolbox, you must have installed MATLAB 7 (R14, 2004) or later, with a working Java Virtual Machine (JVM) that supports Java 1.4 or later. There are currently no plans to support earlier versions of MATLAB or Java. If necessary, it may be possible to upgrade the JVM used by an installation of MATLAB; see this MathWorks technical note on the subject.

The WFDB Toolbox has been developed and tested using Sun's Java (available freely from http://www.java.com). It is compatible with at least some versions of OpenJDK (IcedTea); if you have problems installing it using IcedTea, try using Sun's Java. Future versions of OpenJDK and of the WFDB Toolbox should be fully compatible.

Supported Platforms

The WFDB Toolbox has been tested on all platforms currently supported by MATLAB, except for Solaris 64; it additionally runs on MacOS X PPC (which is supported only by older versions of MATLAB).

Operating systems and architectures

The following table shows which CPU architectures are supported for which operating systems.

AMD64, a.k.a. x86-64 i386, a.k.a. x86 (IA-32) PowerPC
Windows XP/Vista/7 YES YES N/A
GNU/Linux YES YES N/A
Mac OS X 10.5 and later YES YES YES

MATLAB versions

Though only a few versions of MATLAB have been tested (including 7.0, 7.1, 7.3, 7.7, and 7.10), the WFDB Toolbox is expected to work for any version of MATLAB with a JVM version 1.4.0 or higher. If you are having trouble with a version of MATLAB that you think should work, you are strongly encouraged to contact us so that we can investigate the problem.

Notes on dependencies

The following external dependencies are used by the WFDB Toolbox for MATLAB. The version numbers listed are those of the shared libraries distributed with the WFDB Toolbox; using a newer minor version of any of these should be safe, but is not necessarily guaranteed to work.

cURL 7.19.3 http://curl.haxx.se
GnuTLS 2.6.4 http://www.gnu.org/software/gnutls
GnuPG 1.4.4 http://www.gnupg.org
Libgpg-error 1.7 http://www.gnupg.org/download/#libgpg-error
Libidn 1.12 http://www.gnu.org/software/libidn
WFDB 10.4.21 http://physionet.org/physiotools/wfdb.shtml
WFDB SWIG Wrappers 10.4.1 http://www.physionet.org/physiotools/wfdb-swig.shtml

Note that GnuTLS, GnuPG, and Libgpg-error can be omitted if SSL support in cURL is turned off.

Compilation on GNU/Linux and Mac OS X is fairly straightfoward. On Windows, MinGW is required. It should be possible to use Cygwin's gcc with the -mno-cygwin option to compile native Windows binaries, but this has not been tested. Linking with Cygwin's POSIX emulation DLL (cygwin1.dll) is not recommended, as it does not interact well with JNI.

Alternative Download Sites

The WFDB Toolbox can also be downloaded from the Google Code wfdb-matlab-toolbox repository or from The MathWorks Code Repository.