LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

tdms peak/valley detection for a reaction timer

I am trying to make a reaction timer .vi in LV 8.2 with the following attributes:
 
1.Uses "Peak Detection and Display" example vi (or something similar), but reads in a two-channel TDMS file instead of the generated signal in the example.
-The TDMS file contains a stimulus channel (Dev1/ai0) and a response channel (Dev1/ai1).
 
 2.The program should find the peaks in the stimulus channel and the valleys in the response channel
-Then the .vi will analyze the time lapse from the stimulus generation peak to the response valley to determine reaction time in milliseconds.
 
3.  The threshold for each peak/ valley should be able to be manually adjusted on the waveform graph.
 
I have attached a .vi with the essentials in place but it needs fixing.  The .vi does not detect any peak or valleys in the file.  It possibly does not work due to the input not liking TDMS files. 
 
Any suggestions for adjusting the input so that it accepts a TDMS file and correctly finds the peaks/valleys?
 
 
-Trij
 
 
0 Kudos
Message 1 of 2
(2,710 Views)
You're passing an array of waveforms into the peak detector subVI. The red coercion dot indicates that this is a "valid" typecast, but the outcome is not going to be what you want (in at least one of the cases). I recommend using "index array" to make sure you wire the right waveforms to the inputs of the peak detector VI.

A more efficient way of solving this would be to get a 2d array of doubles out of "TDMS Read" and use "index array" in order to split it up in 2 channels.

Hope that helps,
Herbert
0 Kudos
Message 2 of 2
(2,699 Views)