The WFDB Toolbox for MATLAB FAQ

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

How can I find the native WFDB Library version the toolbox uses?

Problem: How can I find the version of the native WFDB library used by the WFDB App Toolbox?

Solution: Information about the configuration of the WFDB App Toolbox can be obtained by typing:

 [~,config]=wfdbloadlib()

The item labeled WFDB_VERSION is the version of the native WFDB libraray being used by the Toolbox.

Is the WFDB App Toolbox supported in 32-bit systems ?

Problem: When I try to run the toolbox on my 32-bit version of Windows I get the following error message:

java.io.IOException: Cannot run program "...\WFDB_Toolbox\mcode\nativelibs\windows-x86\bin\rdsamp": CreateProcess error=2, The system cannot find the file specified
                at java.lang.ProcessBuilder.start(Unknown Source)
                at org.physionet.wfdb.Wfdbexec.execToDoubleArray(Unknown Source)
Caused by: java.io.IOException: CreateProcess error=2, The system cannot find the file specified
                at java.lang.ProcessImpl.create(Native Method)
                at java.lang.ProcessImpl.(Unknown Source)
                at java.lang.ProcessImpl.start(Unknown Source)

Solution: The WFDB App Toolbox for MATLAB currently does not support 32-bit versions of Windows. If you do not wish to upgrade your system, you can use an older version of the toolbox, WFDB Swig MATLAB , that may work with your 32-bit Windows machine.

How can I improve the memory use of the WFDB Toolbox?

Problem: When I try to read a record into MATLAB I get the following error messages (or a variation of):

>> [sig, Fs, t] = rdsamp('mghdb/mgh073');
Error using rdsamp (line 163)
Java exception occurred:
java.lang.OutOfMemoryError: Java heap space
at java.util.Arrays.copyOfRange(Arrays.java:2694)
at java.lang.String.(String.java:203)
at java.lang.String.substring(String.java:1913)
at java.lang.String.subSequence(String.java:1946)
at java.util.regex.Pattern.split(Pattern.java:1202)
at java.lang.String.split(String.java:2313)
at java.lang.String.split(String.java:2355)
at org.physionet.wfdb.Wfdbexec.execToDoubleArray(Unknown Source)
(snip)

Solution: There are a couple of options that you can try to increase or make memory management more efficient when using the WFDB Toolbox. The following list of suggestions can be used either in combination of by themselves:

  • Increase MATLAB's Java heap size. For information on how to do that please see The MathWorks note.
  • Read only the signal that you are interested in processing. For example, if you interested in only processing the first signal, you can do run the command:
    [sig, Fs, t] = rdsamp('mghdb/mgh073',[1]);
    
  • Read only a section of the signal at a time. For example, you can do run the command to read the first 1,000 samples of all signals:
    [sig, Fs, t] = rdsamp('mghdb/mgh073',[],1000);
    
  • Consider reading signals in another datatype besides double precision (which is the default for a variable in MATLAB). Reading signals in single precision with RDSAMP is a natural first choice, which will minimize the memory requirements by half, if there is no need for double precision accuracy. To read the signals with double precision set the 'rawUnits' flag to '2', for example:
    [sig, Fs, t] = rdsamp('mghdb/mgh073',[],[],[],2);
    

    For more information on other options on the datatypes please see the help in RDSAMP.

  • Why are WFDB Toolbox for MATLAB commands sometimes unable to read remote data?

    Problem: Using software based on the WFDB library, such as the WFDB Toolbox for MATLAB, it should be possible to read PhysioBank data directly from PhysioNet (i.e., without downloading files first). For example, after starting MATLAB and installing the WFDB Toolbox, this command should not result in an error:

    %%This will attempt to read data from PhysioNet servers using libcurl.
    %%It assumes that you have never loaded the record mitdb/100 in your machine
    %%before (otherwise it could be cached in your system and still work).
    [tm,signal]=rdsamp('mitdb/100');size(signal)
    

    This command should produce this output:

    ans =
    
           21600           2
    

    For reasons we have not yet determined, this command fails on some machines, producing this output instead:

    Warning: Could not get signal information. Attempting to read signal
    without buffering.
    > In rdsamp at 107
    Command exited with non-zero status!!
    Error using rdsamp (line 152)
    Java exception occurred:
    java.lang.NullPointerException
    at org.physionet.wfdb.Wfdbexec.execToDoubleArray(Unknown Source)
    

    If this happens, any WFDB toolbox commands that attempt to access remote data will fail similarly. We have been able to observe this problem on one of two apparently identically configured Windows 7 machines; on the second machine, the problem does not occur. The toolbox is normally able to behave as a web client to retrieve data from the PhysioNet server by using the libcurl library (DLL). Our best guess about the cause of the problem is that the Java virtual machine (JVM) invoked by the toolbox functions is unable to load libcurl, either because the JVM is not looking in the correct location, or because a security setting prevents the JVM from loading libcurl.

    Solution:

    Whether or not you encounter the problem described above, you can always use the WFDB Toolbox for MATLAB to read data files within the current directory or a subdirectory of it. There are several ways to download data files from PhysioNet, described below.

    • To download a single record, you can use your web browser. Navigate to http://physionet.org/physiobank/database and follow the links to the data set of interest. For example, you will find the MIT-BIH Arrhythmia Database at http://physionet.org/physiobank/database/mitdb/. In most cases, a record is stored in multiple files with the same base name (the record name) and different suffixes, and you will generally need to download all of them for any record of interest. For example, record 100 of the MIT-BIH Arrhythmia Database includes a short text header file (100.hea), a longer binary signal file (100.dat), and a medium-length binary annotation file (100.atr).
    • To download an entire database (a set of records), there are several efficient methods. Two of the recommended methods are described in the PhysioNet FAQ, at: http://physionet.org/faq.shtml#downloading-databases and http://physionet.org/faq.shtml#zip-tar. These methods are recommended because they can update previously downloaded databases quickly, and because they can complete interrupted downloads efficiently. The first method is preferred if you can use it, because it has the lowest impact on the PhysioNet servers.
    • The WFDB toolbox (version 0.9.5 and later) provides the PHYSIONETDB function for downloading the header and signal files (but not the annotation files) of a database. For example, download all of the .hea and .dat files of the MIT-BIH Arrhythmia Database from the MATLAB prompt using the command:
          rc=physionetdb('mitdb',1);
      

    Why cant I run the WFDB demo in Octave under Windows?

    Problem: When I try to run the 'wfdbdemo' in Octave for Windows I get the following error message:

    error: regexp: \ at end of pattern at position 1 of expression
    

    Solution: This is an issue with the parsing in the WFDB function '{toolbox-dir}/mcode/wdfdbloadlib.m' under Windows Octave. Please change the following section (line numbers 75):

    inOctave=is_octave;
    
    to the following :
    inOctave=is_octave;
    if(ispc && inOctave)
    filesep=[filesep filesep]; %Need to escape '\' for regexp in Octave and Windows
    end
    
    and save the file. Additionally, in some Windows machines its possible to have a 32-bit JVM runnning on a 64 bit processor. In these systems, please rename the following directory
    {toolbox-dir}\mcode\nativelibs\windows-amd64
    
    , to the following name :
    {toolbox-dir}\mcode\nativelibs\windows-x86
    

    What are all the known issues and future enhancements?

    For a complete list of known issues and future enhancements please see the code repository issue list.

    How can I report a bug or request an enhancement ?

    Before reporting a bug or enhancement request, please check the code repository issue list in order to avoid creating duplicates. You can report a bug or request a future enhancement using any of the following three methods:

    • Email us with the exact steps to necessary to reproduce the bug or the enhancement request.
    • Post your request on the user's group.
    • Create an issue on code repository issue list.