Next: WFDBCAT(1) Up: WFDB Applications Guide Previous: WFDB-CONFIG(1) | On This Page |
This program converts the signals of any PhysioBank record (or one in any compatible format) into a record.mat file that can be read directly using any version of Matlab, and a short record.hea text file containing information about the signals (names, gains, baselines, units, sampling frequency, and start time/date if known). In addition, wfdb2mat writes a brief summary of this information to the standard output.
The .mat and .hea output files can also be read by any WFDB application as record RECm.
This program does not convert annotation files; for that task, rdann(1) is recommended.
The output .mat file contains a single matrix named val, containing raw (unshifted, unscaled) samples from the selected record. Using various options (below), one can select any time interval within a record, or any subset of the signals, which can be rearranged as desired within the rows of the matrix. Since .mat files are written in column-major order (i.e., all of column n precedes all of column n+1), each vector of samples is written as a column rather than as a row, so that the column number in the .mat file equals the sample number in the input record. If this seems odd, transpose your matrix after reading it!
This program writes version 4 MAT-file format output files (see http://www.mathworks.com/access/helpdesk/help/pdf_doc/matlab/matfile_format.pdf for details). The samples are written as 32-bit signed integers in little-endian format if the record contains any format 24 or format 32 signals, as 8-bit unsigned integers if the record contains only 8-bit unsigned samples, or as 16-bit signed integers in little-endian format otherwise. Although version 5 and newer versions of Matlab normally use a different (less compact and more complex) format, they can read these files without difficulty. The advantage of version 4 MAT-file format, apart from compactness and portability, is that files in these formats are still WFDB-compatible, given the .hea file constructed by this program.
Options for wfdb2mat include:
To convert record mitdb/200, use this command:
wfdb2mat -r mitdb/200
This works even if the input files have not been downloaded; in this case, wfdb2mat reads them directly from the PhysioNet server.
The output
files are mitdb/200m.mat and mitdb/200m.hea. Note that if a subdirectory
of the current directory named mitdb did not exist already, it would be
created by wfdb2mat. In addition, if the standard output of wfdb2mat has
been saved in a file named mitdb/200m.info, then the converted data can
be read and plotted in Matlab or Octave from within the mitdb directory
by running the command:
plotATM(’200m.mat’, ’200m.info’)
(Download http://physionet.org/physiotools/matlab/plotATM.m and install it
in your Matlab or Octave environment first.)
Note that when EDF (or EDF+, BDF, or BDF+) files are used as input, they may have empty ’physical dimension’ (units) fields, which imply that the associated signals are dimensionless (for example, they may be event markers or categorical variables). In such cases, wfdb2mat records the signal units as nd (no dimension).
It may be necessary to set and export the shell variable WFDB (see setwfdb(1) ).
The PhysioNet ATM (http://physionet.org/cgi-bin/ATM) provides web access to wfdb2mat (select Export signals as .mat from the Toolbox).
http://physionet.org/physiotools/matlab/plotATM.m
Please e-mail your comments and suggestions to webmaster@physionet.org, or post them to:
PhysioNetUpdated 10 June 2022