LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

Join 1D three arrays together become a 1d array

How to join three 1d arrays to become a new id array.
array 1 = 1 2 3
array 2 = a b c
array 3 = A B C
new array = 1 2 3 a b c A B C
0 Kudos
Message 1 of 11
(4,643 Views)
Use a "Build Array" with your 3 arrays as inputs, enable "Concatenate Inputs" from its pop-up menu and you'll have the expected result. In case you are performing this operation inside a loop or dealing with big arrays, you may try to find a better solution (regarding resources usage).

Hope this helps
Message 2 of 11
(4,643 Views)
> How to join three 1d arrays to become a new id array.
> array 1 = 1 2 3
> array 2 = a b c
> array 3 = A B C
> new array = 1 2 3 a b c A B C
>

The function is called build array. Grow it to have three inputs
and the output will be what you want.

Greg McKaskle
0 Kudos
Message 3 of 11
(4,643 Views)
You can accomplish the same result in a loop by using Shift Register with Build Array function.
0 Kudos
Message 4 of 11
(4,644 Views)
I tried doing the above suggestion but it doesn't work. See attached jpg. I selected CONCATENATE from the menu, but only the top 8 elements appear to reflect the correct data. All 24 bits should be on. What am I doing wrong?
0 Kudos
Message 5 of 11
(4,440 Views)
Try doing it without using the local variables. Not only are they totally unnecessary, you have what is called a race condition. Just by placing the locals to the right of the terminals, does not mean that the build array code executes after the DAQ Assistant writes to them. Just the opposite is probably happening. You need to understand the basics of DATAFLOW. Functions not connected by dataflow, will operate in parallel.
0 Kudos
Message 6 of 11
(4,428 Views)

Remove the local variables and wire directly from the port indicators to the build array.  That may help.

In addition I would suggest adding a stop boolean control to the front panel rather than wiring a false constant into the while loop conditional terminal.  You should not be using the stop sign button (abort) near the run button.  There is rarely if ever a reason to use that button.

0 Kudos
Message 7 of 11
(4,426 Views)
Thank you Evan and Dennis. Yes I am a beginner with Labview and I appreciate your patience. I incorporated your suggestions to no avail. See attached jpg. Still, only 1 of 3  ports data is displayed.
0 Kudos
Message 8 of 11
(4,418 Views)
What is the datatype of the integer value? In other words, how big are the arrays? It seems to me they might be longer than 8 bits.
 
Maybe you need a "To U8" before creating the boolean array, or you can trim the three arrays to lenght 8 instead.
Message 9 of 11
(4,406 Views)

I think I know what the problem is. The DAQ Assistant alwats returns an I32 array. When you convert an I32 number to a Boolean Array, you get a Boolean array with 32 elements. You could click through all of the elements in the result array and you will see that you've appended 3 32 element arrays together. Your true indicators are there. To fix your problem, place a To Unsigned Byte Integer (U8) conversion on the output of the DAQ Assistant. Then you'll just have arrays with 8 elements.

p.s. If you were to use the lower level DAQmx Read function, you wouldn't have to do this. The DAQmx Read gives you the option of returning a U8 array. The DAQ Assistant does not have this flexibility.

Message Edited by Dennis Knutson on 04-18-2007 12:03 PM

Message 10 of 11
(4,406 Views)