C file: example.f G. Moody 23 August 1995 C C Sample program illustrating use of Fortran wrappers for the DB library C C Copyright(C) Massachusetts Institute of Technology 1995. All rights reserved. C C This program is a slightly elaborated version of the C example shown in C section 1.1 of the ECG Database Programmer's Guide. It uses the DB library C to open record 100s (a sample record, provided in the `microdb' directory at C the same level as this one). The program prints the number of signals, the C sampling frequency, and the first ten samples from each signal. C C To compile this program on a UNIX system, type: C f77 example.f dbf.c -ldb C To run the resulting executable file, type: C a.out C Compare the output with that shown in section 1.4 of the ECG Database C Programmer's Guide. C C If your Fortran compiler is a very old one, you might need to replace the C tabs at the beginnings of the lines below with spaces. C The next two lines specify the data types returned by the wrappers. implicit integer(a-z) real aduphys, getbasecount, getcfreq, sampfreq integer i, v(32), g real f C Open up to 32 signals from record 100s. (There are only 2 signals in this C record, however.) To open more than 32 signals in any record, you will need C to modify DB_MAXSIG in , and recompile the DB library. i = isigopen("100s", 32) write (6,1) i 1 format("Number of signals in record 100s = ", i2) C Check out the sampling frequency of record 100s. The returned value is C the sampling frequency in Hz, represented as a C double (Fortran real) value. f = sampfreq("100s") write (6,2) f 2 format("Sampling frequency = ", f6.2) C Read the first 10 samples from each signal. The value returned from getvec C is the number of signals; the samples themselves are filled into the v C array by getvec: v(1) contains a sample for signal 0, v(2) for signal 1. do i = 1, 10 g = getvec(v) write (6,3) v(1), v(2) 3 format("v(1) = ", i4, " v(2) = ", i4) end do end