LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

concatenate boolean arrays

I have created the attached vi, as part of a MUCH larger vi that I have developed over several months.  The main function of this "sub" vi is to allow the user more flexibilty by allowing him (or her) to vary the number of test probes used.  The probes are selected sequentially by outputting a low (gnd) on the appropriate Digital I/O pin of a USB-6009 multi-function DAQ module.   In order to do this, I need to concatenate two boolean arrays, so that the array of 4 values is placed ahead of the array of 8 values (making it eighted heavier in value), so that I have a 12-bit "word" vice and 8-bit word.  Once they are concatenated, I feed them into a "Boolean array-to-number" function.  The output from that function goes to a case structure.  Obviously, I cannot simply add them together, since I want the 4 bits to be more significant than the other 8.  (This way I have an array of values from 2^0 through 2^11).  Any suggestions anyone?
0 Kudos
Message 1 of 7
(5,992 Views)
Using the Build array in the array pallet you can concatinate any two arrays of the same type.
0 Kudos
Message 2 of 7
(5,987 Views)
I noticed that your arrays to your "for" loop are of different dimensions.  Since you do not wire a value to the N terminal of the for loop the number of times that the loop will execute is controlled by the number of elements in the arrays.  But since they are not the same size you will either stop with the small dimension or index empty elements in the smaller dimension (not sure wich one, need to research).  Just FYI.
0 Kudos
Message 3 of 7
(5,980 Views)
One thing to make sure of is once you place the "build array" function on the block diagram, right click it, and ensure "Concatenate Inputs" is checked.
Message 4 of 7
(5,979 Views)

Paul is correct but here is another thought.

"Obviously, I cannot simply add them together, "

Yes, but if you

Multiply the 4-bit value by the appropriate power of two,

or

do a binary shift left by eight

you can then add them together.

Ben

Retired Senior Automation Systems Architect with Data Science Automation LabVIEW Champion Knight of NI and Prepper LinkedIn Profile YouTube Channel
0 Kudos
Message 5 of 7
(5,977 Views)

Granted, I don't know the rest of your code, but why don't you just generate it as a max 12x12 array from the beginning?

 

Message 6 of 7
(5,961 Views)
Actually, if you want it to act more similar to your code, you should change my code as follows:
 
Modify as needed.
 
 

Message Edited by altenbach on 08-03-2006 02:18 PM

0 Kudos
Message 7 of 7
(5,943 Views)