LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

Building a 2D array on another 2D array

Solved!
Go to solution

Hi,

    I do have some problem in building 2D array. Currently, I do have a 2D array of 2 x 3. I would like to build another array to 2 x 6.

Example [1 2 3    and   [7 8 9       to  [ 1 2 3  7 8 9

                 4 5 6]            1 2  3]             4 5 6 1 2 3  ]

 

I have tried to use insert array but its does not seems to be working as i have place the index at col 3, while inserting the second 2D array. I wonder I could a achieved to a 2 x 6 array. I appreciated if someone could assist me? Thanks a lot.

0 Kudos
Message 1 of 7
(3,646 Views)

Hi kengkc,

you can use "transpose 2D array" and "build array" to get what you want.

 

Mike

0 Kudos
Message 2 of 7
(3,644 Views)
Another way would be to use insert into array by enabling the column input. Have a look at the attached image.
Message Edited by Adnan Z on 02-26-2009 05:58 PM
Adnan Zafar
Certified LabVIEW Architect
Coleman Technologies
0 Kudos
Message 3 of 7
(3,639 Views)

Hi Mike,

             I'm sorry. The solution could not work. i have tried to use a shift register to get back the previous value but was given an error of wiring of 3D to 2D. Actually, I also wanted to append several 2D array but in the form of earlier of 2 rows with the increasing of columns. I wonder if there is any solution? Thanks a lot.

0 Kudos
Message 4 of 7
(3,610 Views)
Solution
Accepted by topic author kengkc

Heres a solution I came up with.

I'm not sure if its the best/worst way to go, but it does the trick Smiley Wink

Basically, heres whats going on:
- you have a for loop that runs an iteration for each row, which is why I used 'Array Size' for N.
- you use 'i' to index which row you are working on
- insert the first set of columns before the second set of columns.
- then when the wire leaves the For loop, it will auto-index and create a new 2D array
Let me know how it works.
Message Edited by Cory K on 02-26-2009 11:04 AM
Cory K
Message 5 of 7
(3,598 Views)

Hi keng,

 

why don't you use the "append array" method to build your array?

 

Apart from your 2d/3d array problem:

Why do you convert arrays to clusters to unbundle scalar values? Wouldn't an "Index array" operation do the same with less effort?

And why do you do math on scalar values when you could do the same math on the whole array - also with less effort?

 

 

Best regards,
GerdW


using LV2016/2019/2021 on Win10/11+cRIO, TestStand2016/2019
Message 6 of 7
(3,569 Views)

Hi Cory,

             Thanks. I have do some modification and it works. Thanks for your help. 😉

0 Kudos
Message 7 of 7
(3,546 Views)