This software assumes that data has been read into Matlab in the following format: three variables, each one a single column and all of the same length, that contain:
vals
The data values recorded. These might be RR intervals,
blood pressure values, etc.
times
Time stamps giving the time of occurance in seconds of each
data point in the first variable. The base time can be selected at
your own convenience.
labels
Numerical labels marking each datum. The labels can be selected
at your own convenience (for example, marking each heart beat as a normal,
PVC, etc.); ultimately they must be converted to numerical flags 1 or 0
marking the datum as valid (1) or invalid (0).
vals
,
times
, and
labels
, but you may want to exploit the name to keep track
of the origin of the data.
If you have a list of events (for example, the times at which interventions were made, or diary entries indicating when a subject engaged in certain activities), it is convenient to store this as a 2-column matrix, with the start time of the event in the first column, and the ending time in the second column. You may want to store the labels or descriptions of the events in a character matrix, with one row for each event.
Heart rate data are commonly initially recorded either as times of R waves, or as RR-intervals.
If you have R-wave times in the variable rawtimes
, and
beat labels in rawlabels
you can do the following to
translate into the times,vals,labels
format. (If you don't
have the labels, just make them
( rawlabels = ones(size(vals),1);
).
rr = diff(rawtimes); times = rawtimes(1:(length(rawtimes)-1)); labels = killneibs(rawlabels,1,0,goodlabel); labels = labels(2:length(labels));The first line simply takes the difference between successive R-wave times to calculate the RR interval. The second line marks as the time of each RR interval the time of the initial beat in the interval. This is somewhat arbitrary --- the time of the second beat might have been used instead. The third and fourth lines reflect the fact that a glitchy R-wave affects two RR intervals. The variable
goodlabel
is the numerical code that marks a valid
beat.
If you do not have beat labels, you can generate placeholder labels where all beats are marked as valid using the command
labels = ones(size(vals),1);
Some analysis methods presume that the data are stored as
heart rate evenly sampled in time. The program
hrtach
performs the conversion between RR interval and evenly sampled heart
rate, using the Berger tachometer algorithm.