LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

insert 2D array columns into 2D array (with different size)

 

 

 Hello,

 

how to simply add columns in a 2D table (in a 2D table of different size : smaller)?

 

e.g : same as output array 1 , but with result output array 2 :

 

 

Image 2.png

 

Image 3.png

 

 

 

Thanks.

 

Ludovic

0 Kudos
Message 1 of 13
(5,390 Views)

Labview does not support ragged arrays. All rows or columns have to be the same length.

 

If course you could simply format it into a table and use empty strings in places where you don't want to see anything.

0 Kudos
Message 2 of 13
(5,387 Views)

Is a lot of code for a small function ..... right? (output array 3 excepted)

 

 

 

 

Image 4.png

 

 

Ludovic

 

0 Kudos
Message 3 of 13
(5,373 Views)

That seems really convoluted. I would just initialize a 2D array of strings at the final rectangular size, then use "replace array subset" to place the two arrays.

0 Kudos
Message 4 of 13
(5,369 Views)

This is another work around.

 

Build Table.png

 

build Table-FP.png

 

Good luck.

 

-----

The best solution is the one you find it by yourself
0 Kudos
Message 5 of 13
(5,358 Views)

@altenbach wrote:

That seems really convoluted. I would just initialize a 2D array of strings at the final rectangular size, then use "replace array subset" to place the two arrays.


Here's what I had in mind.

 

 

Download All
0 Kudos
Message 6 of 13
(5,343 Views)

Of course you could also use the matrix size to ge the various dimensions. 😄

 

 

0 Kudos
Message 7 of 13
(5,335 Views)

P@Anand wrote:

This is another work around.

 

Build Table.png

 


That first "reshape array" is actually not needed. The following is equivalent. Try it!

 

 

My earlier version has significantly fewer buffer allocations, so it might be more efficient for large arrays (not tested).

0 Kudos
Message 8 of 13
(5,327 Views)

Hello,

 

Thanks for replyes,

 

I like last solution (little function & fewer buffer) , but if i build 2x2D array, you have 3D table ??? (how do you do ?)

 

 

Thanks 

 

Ludovic

0 Kudos
Message 9 of 13
(5,318 Views)

Hi Ludovic,

 

right-click the BuildArray and set "concatenate inputs" mode…

 

@PAnand:

Why do you need to convert an array to a cluster to simply INDEX the elements?

Best regards,
GerdW


using LV2016/2019/2021 on Win10/11+cRIO, TestStand2016/2019
0 Kudos
Message 10 of 13
(5,312 Views)