LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

Detect empty element in cluster

Hi,

 

I want to know if there is a way to detect empty elements on a cluster, with no dependencies on the type/format of the cluster.

I have tried to construct a function with a cluster reference input, use property node "Controls[]" and then check the value in every element in a for loop. But in this approach, if i alter the cluster format, i have to change the reference input.

Is it possible to do detect empty elements in different way that could apply to all clusters without changes?

0 Kudos
Message 1 of 7
(5,877 Views)

Please define "empty element". I know the term "empty array", which refers to an array which has no element in it.

 

Is it possible that you refer to "default value"?

 

Norbert

Norbert
----------------------------------------------------------------------------------------------------
CEO: What exactly is stopping us from doing this?
Expert: Geometry
Marketing Manager: Just ignore it.
Message 2 of 7
(5,865 Views)

Yes, when i mentioned empty element i should have said different element than default.

0 Kudos
Message 3 of 7
(5,861 Views)

Did you try the "Equal?" function? Or, in your case maybe better the "Not Equal?" function....

 

Norbert

Norbert
----------------------------------------------------------------------------------------------------
CEO: What exactly is stopping us from doing this?
Expert: Geometry
Marketing Manager: Just ignore it.
0 Kudos
Message 4 of 7
(5,855 Views)

The problem is not that, as i said above i have managed to built a vi that verifies if the elements of the cluster are equal to default.

But if i try to use a different cluster as input for that vi, it gives me a error because the cluster has a different format (has more elements, different elements type).

So i would like to know if there is a easier solution compatible with all clusters.

0 Kudos
Message 5 of 7
(5,849 Views)

As i said: The Equal? function from the comparison palette.

 

Granted, there are some specific elements in cluster which could fail in that comparison, but the common elements work....

 

Norbert

Norbert
----------------------------------------------------------------------------------------------------
CEO: What exactly is stopping us from doing this?
Expert: Geometry
Marketing Manager: Just ignore it.
0 Kudos
Message 6 of 7
(5,844 Views)

Clusters with different elements (as type or number of elements rather than different values of an element) are different datatypes. LabVIEW is a strictly typed language meaning that you cannot easily connect different datatypes together.

 

You could use variants as the input control which would allow you to connect anything, but meaningful comparisons are still difficult.

 

Can you tell us more about what you are actually trying to do?  There is probably a better way to accomplish your goal.

 

Lynn

0 Kudos
Message 7 of 7
(5,818 Views)