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: 

case structure tunnels

Hello all.  I seek to populate a Case Structure with 10 cases having DAQ code, located within a While loop.  A front panel numeric input establishes how many of the cases will be selected.  That input is compared to the While loop index, and the While loop terminates when the loop index matches the number of cases to be selected.  The loop index is also delivered to the Case Structure selection portal. 

 

The use of the loop index allows the cases to be selected sequentially, which is what I seek.  However, trying to pass the acquired data through Case tunnels to a Build Array outside the Case and Loop results in a broken arrow unless each Case data tunnel has the "Use Defaults if Unwired" selected.  Accordingly, since "0" is the default value, every time the loop iterates, all outputs except one send "0" to the Build Array.  The array contains the values of interest, with many "0's" interspersed.

 

After speaking with an Applications Engineer, I tried using a single tunnel in the Case structure, and wired that tunnel to a single element in a Build Array.  I was told the output from the various cases would contatenate, and all the data would be available.  Sadly, what happened was that the final data value was the only value in the array.

 

I tried other solutions without success. The broken arrow does not leave without choosing "Use Default..." I've attached a simple example of what I am trying to accomplish.  Any suggestions, and thanks in advance for your help.

0 Kudos
Message 1 of 8
(3,251 Views)

Is this what you're after...

 

Wire all outputs to the same output tunnel and enable indexing on the output tunnel.

 

 

Troy - CLD "If a hammer is the only tool you have, everything starts to look like a nail." ~ Maslow/Kaplan - Law of the instrument
0 Kudos
Message 2 of 8
(3,245 Views)

If you want more control on the output array you can use an array shift register, as in the vi attached.

(for instance if you want to insert elements in a given order, etc...)

 

Marco

0 Kudos
Message 3 of 8
(3,242 Views)

Auto-indexing tunnel is the correct answer.

 

Don't forget to use an increment function on the i terminal.  Remember that the i terminal starts at zero.  So if you say 5 in # of indicators, you'll wind up with 6 right now because the loop won't stop until i=5 which is the 6th iteration.

Message 4 of 8
(3,193 Views)

Yup, Troy, that is exactly what I was looking for.  I didn't know about auto-indexing at the tunnels.  Thanks for the fix; I truly appreciate your time.

0 Kudos
Message 5 of 8
(3,177 Views)

Cool. Don't forget to also do what RavensFan said too.

Troy - CLD "If a hammer is the only tool you have, everything starts to look like a nail." ~ Maslow/Kaplan - Law of the instrument
0 Kudos
Message 6 of 8
(3,175 Views)

Thanks, MarcoMouri.  I wondered about how I might use shift registers to solve the problem.  It wasn't one of the things I tried before posting the message.  Another solution proposed was enabling auto-indexing at the While loop tunnel.  While I knew shift registers might be a solution, I didn't know or had forgotten about auto-indexing.

 

Thanks very much for your solution, and your time.  I'll exercise both solutions in the real VI, and see which one makes more sense.  If nothing else, working with the shift registers will give me a much better understanding of their utilty.  Again thanks.

0 Kudos
Message 7 of 8
(3,174 Views)

Thanks, RavensFan.  I knew about the indexing starting with zero, and intended to make adjustments in the real VI to insure the indexing was correct.  Again, thanks for your suggestion and reminder.

0 Kudos
Message 8 of 8
(3,171 Views)