LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

rearrange 3d array into 2d array

I have a series of 2d arrays that are in the format

x y
x y
x y

then another that is a different size

z a
z a
z a
z a

i want to rearrange them so they are:

x y
x y
x y
z a
z a
z a
z a

i know this is simple but i can't figure it out.
the reason they are different sizes are because of a dependence on the n loop for each part.
help!
0 Kudos
Message 1 of 13
(5,509 Views)
Hello John,

You can use the "Insert Into Array" function. If you do not specify index, the second array will be add at the end of you first array (see .jpg).

By the way, you still have 2D arrays.

Regards,
Chris
0 Kudos
Message 2 of 13
(5,506 Views)
hi sorry the title should read 2 - 2d arrays into 2 - 2d array.
I've found a good way of doing the process with two for loops with a shift register and and array setup with a build array with cocatulate arrays on.
it looks odd but works.
0 Kudos
Message 3 of 13
(5,467 Views)
My way looks a bit easier    Smiley Wink

Good luck for your work !

0 Kudos
Message 4 of 13
(5,462 Views)
John,
 
I would use a built-in function like the insert or append vi's rather than roll your own.  You will never be able to maintain or decipher that thing in the future.  The built-in functions are highly optimized and bullet-proof.  I attached another solution that uses the Build Array.vi.  After dropping the control, right-click the control and select "Concatinate inputs" from the popup menu.
 
-cb
0 Kudos
Message 5 of 13
(5,446 Views)

John,

I have been reading and writting LabVIEW cod efor about tens years and I have to confess that this code,

is not readable.

THis code

is readable.

Ben

 

Retired Senior Automation Systems Architect with Data Science Automation LabVIEW Champion Knight of NI and Prepper LinkedIn Profile YouTube Channel
Message 6 of 13
(5,439 Views)

Darn...  Ben beat me to the post 😉

Well done Ben!

Message 7 of 13
(5,424 Views)
Well, at least we've got another Rube Goldberg entry.

I also don't see where the convoluted method actually generates a 2D array.
0 Kudos
Message 8 of 13
(5,406 Views)
*I fear my name is being sullied* - apologies for showing way more of a giant programme i couldn't crop any more off with 10sec to spare before the end off work!

it generates two 1d arrays that are used together later and combined, the coded part shows a number of processes,

the only bit that carries out the combining is a build array (cocatulate on) that has data sets of 1d of different length, combines each of the 1d arrays into one long 1d array.

it was far simpler to keep the sets in one long one in the end, the image i posted was of about 3 processes, all i needed to show was: see attached

this takes a series of 1d arrays of varying length [governed by the number being passed to N] and stacks them up to produce one long 1d array.

- this was way easier to figure out for me and most importantly it works!
0 Kudos
Message 9 of 13
(5,361 Views)
Indeed it is, because its part of a WAY bigger programme, and i had about 10sec to crop the image before going home,
hay you don't want me to do 'unpaid overtime!' do you?
0 Kudos
Message 10 of 13
(5,359 Views)