I think that the VI you've made is definitely on the right track. You should try increasing the threshold and width values to eliminate the lower peaks (noise) in your data. You can read information on what each of these inputs do in the LabVIEW Help by pressing control+h and hovering over the Peak Detect VI. If you need more information click "detailed help."
I tried playing with these value to get the correct number of peaks (I'm assuming you want to get 21 peaks from the data in your zip file), but I was unable to. I think the issue is that you aren't writing enough digits to your data file. If you take a look at your text file you can see that a number of consecutive x (time) values are identical. This is likely messing up calculations that the Peak Detect VI is doing since it uses a polynomial fit to identify peaks. I would assume that if you increase the digits you write to the file or use the signal directly after you read it without writing to a file then you should be able to adjust the threshold and width to correctly identify your peaks.
I hope this helps get you started.
Have a great day!
You are correct that your analysis should return the same results regardless of whether or not the data is coming from a file or "live" from a DAQmx Read. I think that the issue comes from the amount of data you're analyzing. As your code is written you are acquiring the same number of samples as your sample rate in Hz, so each time you do a DAQmx read it represents 1 second of data. On the other hand since you're file contained many seconds of data you have many peaks. Since typical (human) heart rates are less than 2 beats/second I'd imagine that by only taking 1 second of data you have a number of sample sections that have only a single peak. You're using a Waveform Chart to display your data so it retains the history, however, if you replace these with waveform graphs you'll see the data you're sending into your analysis each time--and likely find that it’s only a single peak. This can cause inaccuracy's with the way you're calculating the BPM. You could either increase the number of samples to read (by using the input on the DAQmx Timing VI as well as the DAQmx Read VI) to increase the number of beats you calculate over, or you can use a shift register to retain the position of the last peak you found and then take the difference between adjacent peaks to calculate the BPM.
You can create a shift register to pass the value of a wire to the next loop iteration by right clicking on the boarder of the loop and selecting "add shift register". Another option would be to use a shift register to build an array of all your data. This would allow you to calculate the average BPM of your data.