LabVIEW Idea Exchange

cancel
Showing results for 
Search instead for 
Did you mean: 
0 Kudos
SteveChandler

Multiplexer

Status: Duplicate

 

When implementing a multiplexer the obvious solution is to use build array and then index array.

 

current.PNG

 

Proposed Alternative. Add an index to build array. If it is wired you get the selected element. If it is not wired it behaves as normal and you get the built array.

proposed.PNG

 

Or maybe there is a right click option for build array to change to the "multiplexer" style.

=====================
LabVIEW 2012


5 Comments
JackDunaway
Trusted Enthusiast
SteveChandler
Trusted Enthusiast

Dang that was quick! I just kudoed that idea. I would have found it if it were spelled correctly!

 

Ok mark this as a duplicate.

=====================
LabVIEW 2012


AristosQueue (NI)
NI Employee (retired)

In the meantime, your "obvious solution" is actually not that efficient memory wise, since we'll copy the values into an array and then copy one element back out of the array. I'd suggest a case structure where one of the three is wired across in each of the three cases. Having said that, I'll put this pattern of "build array followed immediately by index array" on the list of optimizations that LV could add to the compiler to avoid actually building the array.

Laura F.
Active Participant
Status changed to: Duplicate
 
SteveChandler
Trusted Enthusiast

Thanks - that would be an excellent optimization!

 

The only problem with the case structure method is that you have to actually add the cases. Not that big of a deal but build array is more convenient since you can just expand it. But consolidating the index into build array makes for neater diagrams.

=====================
LabVIEW 2012