Keywords: wfdb_tools

Next: Reading annotations Up: Using the WFDB_tools library Previous: Using the WFDB_tools library Contents

# Reading signals

Assuming that the WFDB Software Package has been installed correctly, the record ``100s'' should be available. Reading the first ten samples of this record using MATLAB would be done as:

        >> S = WFDB_isigopen('100s')
        S =
        2x1 struct array with fields:
            fname
            desc
            units
            gain
            initval
            group
            fmt
            spf
            bsize
            adcres
            adczero
            baseline
            nsamp
            cksum
        >> DATA = WFDB_getvec(length(S), 10)
        DATA =
                 995        1011
                 995        1011
                 995        1011
                 995        1011
                 995        1011
                 995        1011
                 995        1011
                 995        1011
                1000        1008
                 997        1008

The first command, `S = WFDB_isigopen('100s')`, reads the header file of record 100s and returns the information in a structure (`S`, in this case). The length of `S` equals the number of signals in the data file. The fields of `S` contain the signal settings. To access, for example, the gain of signal 0 and the description of signal 1, use the commands:

        >> S(1).gain
        ans =
           200
        >> S(2).desc
        ans =
        V5

(Remember: the first signal is signal 0, not signal 1! Its attributes are found in the first structure, `S(1)`. This will matter in later examples.)

The second command, `DATA = WFDB_getvec(length(S), 10)`, reads data from the previously opened record. The two input parameters are the number of signals (found as `length(S)`) and the desired number of samples (if omitted, the whole record is read).

Finally, don't forget

        >> WFDB_wfdbquit

to close all open files.

An elaborated version of this example is provided in the `examples` directory of the WFDB_tools package (look for `example1.m`).

Next: Reading annotations Up: Using the WFDB_tools library Previous: Using the WFDB_tools library Contents