We are trying to use the QRS detector (command `sqrs'). We wil apply it to the file `100.dat'. We begin by exploring the contents of the directory:
-->unix_g('ls')
ans =
!100.atr !
! !
!100.dat !
! !
!100.hea !
! !
!100s.atr !
! !
!100s.dat !
! !
!100s.hea !
Then we type
-->unix ('sqrs -r 100')
ans =
0.
A warning in the terminal where Scilab was initiated indicates that we could consider re-sampling at 250 Hz and a new file called `100.qrs' appears
-->unix_g('ls')
ans =
!100.atr !
! !
!100.dat !
! !
!100.hea !
! !
!100.qrs !
! !
!100s.atr !
! !
!100s.dat !
! !
!100s.hea !
Now we are going to see the content of `100.qrs'. It is an annotation file and can be seen with `rdann'
-->unix_x('rdann -r 100 -a qrs')
0:00.194 70 N 0 0 0
0:01.005 362 N 0 0 0
0:01.822 656 N 0 0 0
0:02.608 939 N 0 0 0
0:03.400 1224 N 0 0 0
0:04.188 1508 N 0 0 0...
We would like to compare the result with `100.atr'. We have a function to compare both files
-->unix_x('bxb -r 100 -a atr qrs')
We get
Beat-by-beat comparison results for record 100
Reference annotator: atr
Test annotator: qrs
Algorithm
n v f q o x
_______________________________
N | 1900 0 0 0 1 0
V | 1 0 0 0 0 0
F | 0 0 0 0 0 0
Q | 0 0 0 0 0 0
O | 0 0 0 0
X | 0 0 0 0
QRS sensitivity: 99.95% (1901/1902)
QRS positive predictivity: 100.00% (1901/1901)
VEB sensitivity: 0.00% (0/1)
VEB positive predictivity: - (0/0)
VEB false positive rate: 0.000% (0/1900)
Beats missed in shutdown: 0.00% (0/1902)
N missed in shutdown: 0.00% (0/1901)
V missed in shutdown: 0.00% (0/1)
F missed in shutdown: - (0/0)
Total shutdown time: 0 seconds
Finally we are going to encode a signal in MIT format. Instead of storing real signals, we will store three columns of random values in the range -5000 to 5000. We store the data as if they would have been sampled at 100 Hz
-->rand('seed',0)
-->x = rand(10,3)*10000 - 5000
x =
! - 2886.7513 608.48606 - 1923.9093 !
! 2560.4385 1623.5694 4329.6162 !
! - 4997.7887 2263.5068 - 2853.9921 !
! - 1696.7291 - 3014.8562 - 1873.58 !
! 1653.811 442.57316 - 1383.639 !
! 1283.9179 - 2679.2521 - 2077.7334 !
! 3497.4524 - 2687.7628 664.24882 !
! 1857.3102 - 2835.3674 - 173.52803 !
! 3782.1648 3833.8878 - 1678.2811 !
! - 4316.2596 1525.1349 935.0947 !
-->fprintfMat('dummy',x)
-->unix('cat dummy| wrsamp -o test -F 100 0 1 2')
ans =
0.
Now we are going to see the result
-->unix_x('rdsamp -r test')
-->rand('seed',0)
-->fprintfMat('dummy',x)
-->unix('cat dummy| wrsamp -o test -F 100 0 1 2')
ans =
0.
-->unix_x('rdsamp -r test')
And the result is
0 -2886 608 -1923
1 2560 1623 4329
2 -4997 2263 -2853
3 -1696 -3014 -1873
4 1653 442 -1383
5 1283 -2679 -2077
6 3497 -2687 664
7 1857 -2835 -173
8 3782 3833 -1678
9 -4316 1525 935
If we see the header
-->unix_x('cat test.header')
then, the result is:
test 3 100 10 test.dat 16 200 12 0 -2886 737 0 column 0 test.dat 16 200 12 0 608 -921 0 column 1 test.dat 16 200 12 0 -1923 -6032 0 column 2We have closed the circle. We can send data from Scilab to WFDB or from WFDB to Scilab. So we can choose the tool more adapted to our work. These chapters are only a little introduction to the properties of WFDB and they are centered in the connection with Scilab. But WFDB has many more functions that are worth to explore.