Next: WFDBDESC(1) Up: WFDB Applications Guide Previous: WFDBCAT(1)On This Page


wfdbcollate - collate WFDB records into a multi-segment record


wfdbcollate -i irec [ irec ... ] -o orec [ -a annotator ]
wfdbcollate orec first last [ -a annotator ]
wfdbcollate -s irec -o orec [ -l segment-length ]


A multi-segment record is the concatenation of one or more ordinary records. A multi-segment record is a ‘‘virtual’’ record, in the sense that it has no signal files of its own. Its header file contains a list of the records that comprise the multi-segment record. A multi-segment record may have associated annotation files, but these are independent of any annotation files that may exist for its constituent segments. It is permissible (though not particularly useful) to create a multi-segment record with only one segment; it is not permissible to use a multi-segment record as a segment within a multi-segment record, however.

wfdbcollate simply constructs an array of segment names, passing it to the WFDB library function setmsheader (see wfdb(3) ) to create a multi-segment header file. In the first form of the command, orec is the name of the multi-segment (output) record to be created, and the irec arguments are the names of the (single-segment) input records that are to be included in the output record. At least one input record name must be specified.

In the second form of the command, orec is again the name of the multi-segment (output) record to be created, and first and last are numbers between 1 and 99999. In this case, orec must be 3 characters or fewer (longer names are truncated), and the names of the input records are derived by appending first, first+1, ..., last to orec (representing first, ..., as 5-digit zero-padded decimal numbers). Thus the command
   wfdbcollate xyz 9 12

is equivalent to
   wfdbcollate -o xyz -i xyz00009 xyz00010 xyz00011 xyz00012

Each segment must contain the same number of signals, and the sampling frequency must be the same for each segment. Each input record header must specify its record length (use wfdbdesc(1) to determine the input record length if necessary, then edit the input record header to include this information before using wfdbcollate). In most cases you will want to be sure that corresponding signals match in each segment, and that the gains, ADC zero levels, and numbers of samples per frame (see header(5) ) also match. It is not necessary that the signal file formats match, however.

In the first two forms, -a annotator is optional; if included, it specifies the annotator name of annotation files associated with the input records, files to be concatenated to form a similarly-named annotation file for orec. Note that all of the files to be concatenated must have the same annotator name. It is not necessary that this annotator exist for each input record, however.

The third form of the command, which includes the -s option, can be used to split an existing record (irec) into multiple segments. In this mode, wfdbcollate first creates a set of segments from irec, then collates them into a multi-segment record. In this mode, the -l option may be used to specify a non-standard segment length, which must be no less than 15 seconds. By default, segments are 10 minutes long, although the last segment in the record may be shorter. The names of the segments created in this way are formed from the first three characters of orec and from a 5-digit zero-padded segment number, as in the second form of the command.

In most cases, multi-segment records are indistinguishable from single-segment records, from the point of view of applications built using the WFDB library (version 9.1 or later). Use xform(1) to generate a single-segment record from a multi-segment record if necessary (for example, to make it readable by an application built using an earlier version of the WFDB library). Note, however, that older applications can generally be updated without source changes simply by recompiling them and linking them with the current WFDB library.


It may be necessary to set and export the shell variable WFDB (see setwfdb(1) ).


output header file
input header file(s)


Under MS-DOS, this program is known as wfdbcoll8.

See Also

wfdbdesc(1) , xform(1) , wfdb(3) , header(5)


George B. Moody (


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 8 March 2019