Burcu, Randall
The origin of the problem is simple : the peak detect vi is not fed with a sufficient number of data !
Look at the results : there are only one or two values in the indice array, whatever the number of peaks in the display. The confusion is due to the fact that Burcu's vi is working with real time data, while Randall and I have been discussing file data or graphic display data (a chart displaying time-stacked data).
In order to work properly, the peak detection algorithm should be fed with at least two peaks. That's not the case here : the vi takes 1300 pts on 3 channels = 433 pts for BR, at a rate of 440/3 = 147 samples/s. Accordingly, less than 3 seconds are recorded at each loop iteration !!!!
Possible solutions to the problem :
A: adapt the actual program
A1/ increase the number of samples, to be sure to get at least 2 peaks (BTW, forget the first peak, and use only peak 1 and 2 : means that you have to record 3 peaks = 15 seconds of record = ask for 6000-7000 pts.
A2/ keep the same sample number, but decrease the sampling rate (BTW Burcu, you are absolutely right with your concern about the sampling rate of ECG data: the sampling frequency is already too low !)
B/ change the algorithm to be able to compute the BR from a series of data acquisitions.
I think there is not enough time for Burcu to rewrite completly his program (sol 3), so the best solutions are 1 or 2. Solution 2 will make things even worse for ECG.
CC
Chilly Charly (aka CC)