From Friday, April 19th (11:00 PM CDT) through Saturday, April 20th (2:00 PM CDT), 2024, ni.com will undergo system upgrades that may result in temporary service interruption.

We appreciate your patience as we improve our online experience.

LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

Question about separating data into N parts according to analog input

Solved!
Go to solution

Hello,

 

I'm working on Tx-switched sensor.

 

Device(s):  a cDAQ-9174 with NI 9263(*1) and NI 9215(*2).

 

The RF Switch at Tx is controlled by NI 9263 analog output model, meanwhile, i use one of the NI 9215 model to read the analog output from NI 9263. And the other NI 9215 keeps reading Rx Data.

 

My question :

 

One of the NI 9215 reads Rx data continuously while Tx is switching, so i need to separate these data into N part(N = Tx number) according to the pattern from analog output.

 

The way i separate data is using case structure, but it's getting slow as the sample rate growing and can't enable loop iteration parallelism.

 

So i wonder if there is a better way to separate data, or maybe other way to deal with RF-Switch control?

 

image.png

To simulate this question , i attach my VI example.

 

Sorry for the unclear explanation, my english is pretty limited.

Thank you!

 

 

Download All
0 Kudos
Message 1 of 4
(2,304 Views)

I assume you know the final size, so you can initialize it at once at that size (if you are worried to be able to tell if it is real data or not, initialize with NaN), the put it in a single shift register and replace sections at the right places as required.

0 Kudos
Message 2 of 4
(2,256 Views)
Solution
Accepted by topic author Andy_lai

Here's how that could look like. Bottom loop. (initialize once at final size. All in-place after that)

 

I swapped the inputs for the bottom array in your code (top) (where you were pre-pending instead of appending) and the results agree after that.

 

If you really want to build the lowest array of the six in the other direction, adjustments are needed.

 

(Depending on how much symmetry is in the index data, it could probably be simplfied further, of course).

 

altenbach_0-1583025896566.png

 

 

 

Message 3 of 4
(2,251 Views)

Thank you!

0 Kudos
Message 4 of 4
(2,231 Views)