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: 

Associating control with an array of active controls in while loop

Solved!
Go to solution

I have an array of "activate" controls which enable a physical DAQ channel. All active channels will be added to a new task. Each channel has a further control "offset" which is supposed to be set during execution. For example: I have an array of 6 "active" controls in which I set channel 1,2, and 5 to active (thus these channels are querried for values by DAQ). Now I need to add the offset "control" associated with each channel in a while loop. Since only the active channels are querried for values, I need a way to select only the "offset" controls associated with these active channels. I do not know a solution to this. How can this be done. The "offset" controls will have to be changed during execution. Please see the attached minimalist VI. Cheers

0 Kudos
Message 1 of 3
(2,159 Views)

I've found a solution using a for loop inside the while loop (see attached snippet). But I find this solution quite ugly. Is there a better way of doing this? In my actual application I need my while loop to iterate as fast as possible and I dont want to repackage the active arrays each time.

0 Kudos
Message 2 of 3
(2,137 Views)
Solution
Accepted by topic author dougbockILT

Learn to use Autoindexing output tunnels.  They allow LabVIEW to make a bunch of optimizations over the Insert Into Array with a Shift Register.  And you can even make them "conditional" with a simple right-click menu.

 

So here is what it looks like after I cleaned it up.  This is probably going to be the simplest solution.


GCentral
There are only two ways to tell somebody thanks: Kudos and Marked Solutions
Unofficial Forum Rules and Guidelines
"Not that we are sufficient in ourselves to claim anything as coming from us, but our sufficiency is from God" - 2 Corinthians 3:5
Message 3 of 3
(2,127 Views)