Assume we have data from three signals. We need to create a signal information structure using:
>> S = WFDB_Siginfo(3)
S =
1x3 struct array with fields:
fname
desc
units
gain
initval
group
fmt
spf
bsize
adcres
adczero
baseline
Now these fields need to be filled with appropriate values. All of them have default values to avoid producing errors, but it is unlikely that they will fit our signals. For example, if signal 0 is the X-lead of a Frank-lead ECG, we may want its description to be:
>> S(1).desc = 'Frank X';
and so on for all other fields. (Remember: the first signal is signal 0; its attributes are in S(1).) When done, we create an empty signal file in which to write the data, using
>> WFDB_osigfopen(S)
We also need to supply the sampling frequency, for example 1 kHz:
>> WFDB_setsampfreq(1000);
and the basetime of the recording (i.e. the time of sample number 0). Assuming the recording was started when my oldest daughter was born:
>> WFDB_setbasetime('02:19:00 02/09/1999')
(Dates used by WFDB_tools are always in DD/MM/YYYY format; 02/09/1999 is 2 September, not February 9.)
Now we're done with providing signal information and it is time to write the actual signal data. This must be stored column-wise in a matrix (one signal per column, one sample per row). If our data is stored in the variable DATA we would use:
>> WFDB_putvec(DATA)
Finally, we need to record the information from S into a header (.hea) file for later use:
>> WFDB_newheader('test1')
The result of these operations will, in the current directory, be a header file, test1.hea, and a signal file with the name specified in the fname fields of the signal information structure, S, above.
Use
>> WFDB_wfdbquit
to reset and exit gracefully.