01-03-2021 09:48 PM
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
Solved! Go to Solution.
01-03-2021 10:30 PM
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'
01-04-2021 12:05 AM
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
01-04-2021 01:22 AM
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
01-04-2021 02:17 AM - edited 01-04-2021 02:19 AM
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.
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!
01-04-2021 02:18 PM
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.
01-04-2021 03:07 PM
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...