LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

How do I convert 1-D array of waveform to array of boolean?

I'm using DAQmx Read to acquire 4 digital channels at 1 kHz. In order to achieve that data rate with a USB-6259 (M-series) I'm reading 100 samples per channel. So the polymorphic form of DAQmx Read is Digital 1D Wfm NChan NSamp and its output is a 1-D array of Digital Waveform. I need to convert the array of digital waveforms into an array of type Boolean. How can I do that? Or is there different form of the DAQmx Read I should use? In order to get an array of boolean output it appears that I would either have to read a single sample at a time (not fast enough) or a whole digital port (doable but not desirable).
 
Andy
0 Kudos
Message 1 of 6
(3,882 Views)
Try this.  I simulated a DAQ device on my machine and set up a DAQmx task acquiring 4 lines on the simulated DAQ card.  100 samples as 1kHz based on PF0 external clock.  It generates a 2D array.  Each row of the array was the data from one line.  Row 0 had ones  or zeroes.  Row 1 had twos or zeroes.  Row2 fours or zeroes.  Row 3 eights or zeroes.  Each column was a sample.  Iterated through to turn into true or false.  Each row of the 2-D array is a 1-D array of booleans for that particular digital line.
 
Attachment is LV 8.5.

Message Edited by Ravens Fan on 09-27-2007 11:46 PM

Download All
Message 2 of 6
(3,869 Views)
Another way using the waveforms
 

Message Edited by Ravens Fan on 09-28-2007 12:00 AM

Message 3 of 6
(3,866 Views)
A digital Waveform is a special data type. I am not very familar with it.
 
(Just a quick comment to Ravens first example: You can delete the two stacked FOR loops and the outcome will be exactly the same. ;))
Message 4 of 6
(3,859 Views)


@altenbach wrote:
A digital Waveform is a special data type. I am not very familar with it.
 
(Just a quick comment to Ravens first example: You can delete the two stacked FOR loops and the outcome will be exactly the same. ;))


You're right.  Please don't post me in the Rube Goldberg thread.  Smiley Very Happy

I haven't worked with digital waveforms either, but have done a lot with Boolean logic, so I figured I could find the right functions on the palettes to get the job done.  So I got into looking at a row at a time or a sample at a time.  I just got to indexing arrays, then rebuilding until I finally found the logic to get the result I wanted.  Never bothered to check if that simple !=0 VI was polymorphic.

Message 5 of 6
(3,854 Views)

Many thanks. I actually was thinking along the line of your second example but I didn't include the for loop.

Andy

0 Kudos
Message 6 of 6
(3,824 Views)