1.8 Exercises
These exercises should require only a few minutes. If you work through
them, you will have an opportunity to become acquainted with a few of
the most common errors in using the WFDB library.
-
Compile the example program in this chapter and run it. If the WFDB
Software Package has not already been installed on your system,
download and install the most recent version from PhysioNet first
(see section Installing the WFDB Software Package).
-
Find out where database records are kept on your system. What records
are available locally?
-
Modify the example program so that you can specify the record to be
opened, either as a command-line argument or by having the program prompt
you to type a record name. If you are unfamiliar with command-line
argument processing, see section Example 2: An Annotation Translator.
-
Use the modified version of the example to read samples from records
‘mitdb/200’, ‘edb/e0103’, ‘slpdb/slp04’, and
‘mimicdb/237/237’. The last two of these records have 4 and 6 signals
respectively, so you will need to make a few additional changes to the program
in order to read these records successfully.
-
Once again using the modified version of the example, what happens if
you omit the path information from one of the records in the previous
exercise (for example, if you try to open ‘e0103’ instead of
‘edb/e0103’? Figure out how to set the WFDB path so that the
program will work properly in this case. (Hint: use the application
‘wfdbwhich’, included with the WFDB Software Package, to find the
header file for record ‘edb/e0103’; this information will help
you to determine how to set the WFDB path.)
-
If you use MS-DOS or MS-Windows, explore and explain what happens in
the previous exercise if you type the record name using upper-case
letters, or if you type a ‘\’ (backslash) instead of ‘/’
(forward slash). (Hint: record names are not filenames!)
-
What happens when you compile the example program as shown, but with the
#include
statement omitted? with the ‘-lwfdb’ (‘-link wfdb’,
etc.) omitted?
-
What is the type of the argument to
getvec
? Why can’t getvec
simply return the value it reads, as in ‘v = getvec()’?
PhysioNet
(wfdb@physionet.org)