[ < ] | [ > ] | [ << ] | [ Up ] | [ >> ] | [Top] | [Contents] | [Index] | [ ? ] |
int putvec(WFDB_Sample *vector) |
This function writes a sample to each input signal. The caller should fill an
array of WFDB_Sample
s with the samples and pass a pointer to this array
to putvec
. (The length of the array must be no less than the number of
output signals, as given to osigfopen
or osigopen
.) On entry,
vector[i] contains the next sample from signal i. For example,
this modified version of the previous example
(see section getvec)
copies the first ten samples of each available input signal:
#include <stdio.h> #include <wfdb/wfdb.h> main() { int i, j, nsig; WFDB_Sample *v; WFDB_Siginfo *s; nsig = isigopen("100s", NULL, 0); if (nsig < 1) exit(1); s = (WFDB_Siginfo *)malloc(nsig * sizeof(WFDB_Siginfo)); if (isigopen("100s", s, nsig) != nsig || osigopen("8l", s, nsig) != nsig) exit(1); v = (WFDB_Sample *)malloc(nsig * sizeof(WFDB_Sample)); for (i = 0; i < 10; i++) if (getvec(v) < 0 || putvec(v) < 0) break; wfdbquit(); exit(0); } |
(See http://www.physionet.org/physiotools/wfdb/examples/exputvec.c for a copy of this program.)
All programs that write signals or annotations must invoke
wfdbquit
to close the output files properly
(see section wfdbquit).
This example uses record `8l' (see section 5.8 Piped and Local Records) for the
output signal specifications; the output signal files will be named
`data0' and `data1' in the current directory. Several of the example
programs in chapter 6 illustrate the use of putvec
; for example,
see section Example 6: A Differentiator.
[ < ] | [ > ] | [ << ] | [ Up ] | [ >> ] | [Top] | [Contents] | [Index] | [ ? ] |