Showing results for 
Search instead for 
Did you mean: 

Compare two empty arrays

Can anyone explain this behavior:

If I compare two empty (equal) arrays, the equal function says they are equal if I select "Compare Aggregates" but not equal if I select "Compare Elements" Smiley Surprised

Why does the "Compare Elements" function says they are not equal when they are?
(I know they are empty, -but they are BOTH empty) 

Please see attached .vi

Br Per

0 Kudos
Message 1 of 5

The compare elements setting is returning an empty array of Boolean values, so there's no result (ie neither true or false).

Certified LabVIEW Architect
Unless otherwise stated, all code snippets and examples provided
by me are "as is", and are free to use and modify without attribution.
0 Kudos
Message 2 of 5

Your array is empty, therefore there is no element in your "compare elements" marked "why?". The element does not even exist, since the array is empty.

Certified LabVIEW Architect
0 Kudos
Message 3 of 5

The result isn't false, it's empty in the case of empty arrays - that is, there are no results.

This is similar to looking at the value of x=y[1] when your arrays only have 1 element each (i.e element [0]).

GCentralI'm attending the GLA Summit!
0 Kudos
Message 4 of 5

Compare aggregate will expect data/value of  inputs(inside of array), If it's an empty array inputs it won't aggregate the inputs. But compare elements won't

Both inputs are should be equal size/length of an aggregate, while the output also would be same size. If both inputs are different sizes while the output would be considered as which input have minimum size of input length

0 Kudos
Message 5 of 5