Next: SIGAMP(1) Up: WFDB Applications Guide Previous: SAMPFREQ(1)On This Page


setwfdb, cshsetwfdb - set WFDB environment variables


. setwfdb
source cshsetwfdb
call setwfdb


WFDB applications search for input files by looking for them in an ordered list of locations called the WFDB path. These locations can be given by directory names or (if the WFDB library has been installed with NETFILES support) URLs. If the WFDB environment variable is set, its value specifies the WFDB path; otherwise, applications use the builtin default path specified at the time the WFDB library was compiled. The default path (DEFWFDB, defined in the WFDB library source file wfdblib.h) includes the current directory (‘‘.’’), the system-wide database directory installed as part of the WFDB Software Package (usually /usr/database), and the PhysioBank data archive (

WFDB applications that need access to the signal calibration database find it in a file located on the WFDB path. If the WFDBCAL environment variable has been set, its value specifies the name of the calibration file; otherwise, applications look for the default calibration file, the name of which (wfdbcal) is compiled into the WFDB library.

Many users will not need to change the defaults, but for those who do, the scripts described here may be helpful. Important: these programs must be customized before using them for the first time on a new machine. Since they are text files, use any text editor to customize them.

sh, bash, and ksh users:

setwfdb sets the environment variables WFDB and WFDBCAL. It must be executed using the ‘‘.’’ as shown above. It may be convenient to include an invocation of setwfdb in your .profile file.

csh and tcsh users:

cshsetwfdb sets WFDB and WFDBCAL similarly for the C-shell. It must be executed using ‘‘source’’ as shown above. It may be convenient to include this command in your .cshrc file.


The database path: a list of directories that contain database files. An empty component is taken to refer to the current directory. All applications built with the wfdb(3) library search for their database input files in the order specified by WFDB. If WFDB is not set, searches are limited to the builtin WFDB path (see above). Under Unix, directory names are separated by colons (:), and the format of WFDB is that of the Bourne shell’s PATH variable (see sh(1) ). Under MS-DOS, directory names are separated by semicolons (;), and the format of WFDB is that of the MS-DOS PATH variable (colons may be used following drive specifiers within WFDB in this case). MacOS does not support environment variables as such; under MacOS, the builtin WFDB path is defined in fdblib.h as described above, and it contains a semicolon-delimited list of directories (folders) as under MS-DOS, but with colons used as directory separators rather than backslashes as under MS-DOS. Alternatively, whitespace can be used (under any environment) to separate components of the WFDB path. Under any environment, if the value of WFDB begins with ‘@’, the remainder of the string is taken as the name of an ‘‘indirect WFDB path file’’ that defines the database path in the format described above. This feature was introduced in WFDB library version 8.0, mainly to permit
MacOS users to modify the WFDB path without recompiling the WFDB library, but it is also useful under MS-DOS to avoid the 128-character limit on the length of environment variables. Indirect WFDB path files can be nested up to 10 levels deep.
The name of the WFDB calibration file (see wfdbcal(5) ). The usual rules for finding WFDB files by searching the WFDB path apply to the WFDB calibration file, so the value of WFDBCAL need not be an absolute path name. The WFDB calibration file is used by WFDB applications that need to plot signals at standard scales, as well as by calsig(1) , which can determine the baseline and gain of signals if calibration pulses are present and if the parameters of the calibration pulses are described in the calibration file. If WFDBCAL is not set by the user, the WFDB library uses a default WFDB calibration file (wfdbcal, named in wfdblib.h). If the WFDB calibration file is not readable, programs that rely on it may not choose appropriate scales for some types of signals.


George B. Moody (


Note that these are templates and will need to be customized before use:

Table of Contents

Up: WFDB Applications Guide

Please e-mail your comments and suggestions to, or post them to:

MIT Room E25-505A
77 Massachusetts Avenue
Cambridge, MA 02139 USA

Updated 28 May 2015