LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

Concatenating 2D Empty Array Yields Strange Result

Solved!
Go to solution

I was debugging an application in newly installed LabVIEW 2020 IDE and came across this strange result:

 

>> 1st Empty 2D-Array when concatenated to 2nd populated 2D-Array, results in 1st row with empty entries.  Is this valid behavior?

>> I was expecting that the result would just be the second 2D array.

 

Has LabVIEW 2020 changed how concatenated empty arrays work?

 

Anthony Lukindo

 

0 Kudos
Message 1 of 7
(1,421 Views)
Solution
Accepted by topic author Anthony_L

Your 'empty' array has a size of 1x0 (1 row and 0 columns).  It then gets expanded to 1x6 by the Build Array operation.  Right-click on the empty array constant and choose 'Data Operations ->Empty Array'

0 Kudos
Message 2 of 7
(1,404 Views)

Hello Darin:

 

That sure did the trick!

 

But the array does look empty? I may be missing something here or this could be a new feature of versions of LabVIEW post LabVIEW 2014.  I assumed that visually one should be able to detect an empty 2D array if the visible "row,col" Index is at "0,0" and elements look disabled (no contents).

 

But thanks! That  sure did the trick.

 

Anthony

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

Follow up question for another scenario: 

 

-- Attached is a diagram and VI showing arrays that I made sure are empty. Yet when these  empty arrays are added together, the array index changes as if there is one populated row with empty cells.

-- Darin's suggestion to empty array worked in the previous example. But here that logic seems to break down.

--The reason why I need this to work is because I am relying on adding an empty array (conditionally) as logic not to modify the result of added arrays.

 

Anthony

Download All
0 Kudos
Message 4 of 7
(1,372 Views)

Hi Anthony,

 


@Anthony_L wrote:

-- Attached is a diagram and VI showing arrays that I made sure are empty. Yet when these  empty arrays are added together, the array index changes as if there is one populated row with empty cells.

 

--The reason why I need this to work is because I am relying on adding an empty array (conditionally) as logic not to modify the result of added arrays.


  1. You are prepending a row before your empty 2D array: you will get one more row and so the result is a 1×0 2D array. Technically still empty as there are no elements (1×0=0), but with one row!
  2. Then you prepend this 1×0 2D array before your populated 2D array: LabVIEW will prepend this one row and increase its size to fit the 2nd array column number!

Both operations act like "expected" IMHO…

 

When you want to avoid building up "technically empty" arrays you should use the EmptyArray? function followed by a case structure!

Best regards,
GerdW


using LV2016/2019/2021 on Win10/11+cRIO, TestStand2016/2019
0 Kudos
Message 5 of 7
(1,358 Views)

Hello GerdW:

 

OK, again, agreed!

 

Interesting that I had yet to notice this behavior after 20 years of intensive programming in LabVIEW. In that case, I would suggest to NI that the concatenate array function includes a menu item that says "Ignore 'Empty Arrays" meaning that if such an array is wired, then no operation should be attempted to build the array using that empty array.

 

I have included a mockup of that menu here.

 

 

0 Kudos
Message 6 of 7
(1,314 Views)

Hi Anthony,

 


@Anthony_L wrote:

In that case, I would suggest to NI...


That's why there is the IdeaExchange to post ideas for possible improvements...

Best regards,
GerdW


using LV2016/2019/2021 on Win10/11+cRIO, TestStand2016/2019
0 Kudos
Message 7 of 7
(1,307 Views)