LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

when spliting data, how to ensure which channel it comes from?

Highlighted

I input signal from two channel and split the data with split vi, usually, the upper wire connect to the ai0 while the lower one connects to ai1, but sometimes it will reverse, what can i do to fix it?

屏幕快照 2019-03-12 下午4.53.38.png

0 Kudos
Message 1 of 5
(535 Views)
Highlighted

Hi frog,

 

I input signal from two channel and split the data with split vi,

Which is your first fault: why use an ExpressVI when you can use a simple IndexArray function?

 

usually, the upper wire connect to the ai0 while the lower one connects to ai1, but sometimes it will reverse, what can i do to fix it?

"Usually" it will ALWAYS have the first channel at the first output and the 2nd channel at the 2nd output. There is nothing to be fixed…

Best regards,
GerdW

using LV2011SP1 + LV2017 (+LV2020 sometimes) on Win10+cRIO
0 Kudos
Message 2 of 5
(511 Views)
Highlighted

Hi GerdW,

Do you mean the Interpolate 1D array? cause the index is not an integer.

But sometimes it get reversed, but it will be normal if I noticed and reopen the file.

Thank you!

0 Kudos
Message 3 of 5
(508 Views)
Highlighted

Hi frog,

 

Do you mean the Interpolate 1D array?

No: you asked for those "split signals" operation and I answered for that "split signals" ExpressVI…

Best regards,
GerdW

using LV2011SP1 + LV2017 (+LV2020 sometimes) on Win10+cRIO
0 Kudos
Message 4 of 5
(506 Views)

To expand slightly on GerdW's response, I was (pleasantly) surprised to see you were using DAQmx functions (instead of the Dreaded DAQ Assistant, which usually goes hand-in-hand with its Evil Twin, the Dynamic Data Wire).  However, the ever-to-be-avoided Dynamic Data Wire showed up, anyway.  Why?  You're generating a 1D Array of Waveform (just look at the DAQmx Read function), so simply use Index Array and pluck the individual Waveforms off one at a time (note that if you don't wire the "index" inputs to Index Array, they default to 0, 1, 2, ...).  Also note that if you don't want to deal with Waveforms, but want a 2D Array of Dbls, you can simply change the Polymorphic DAQmx Read function and the Index Array function will give you directly each channel's data as an Array of Dbl (instead of as a Waveform).

Index Array, avoiding Dynamic Data WireIndex Array, avoiding Dynamic Data Wire

Bob Schor

Message 5 of 5
(496 Views)