LabVIEW Idea Exchange

cancel
Showing results for 
Search instead for 
Did you mean: 
Chris_Koci

Allow Array to Cluster Type

Status: New

The "Array to Cluster" primitive should allow you to pass in a cluster type.  This allows the output of the primitive to know the names of the elements, as well as how many there are.  If the cluster type is wired, you would not need to specify Cluster Size.

 

array to known cluster.PNG

7 Comments
Knight of NI
This may be a subset (or superset) of this idea: Change CLUSTER SIZE to a Wired Input.
Jim_Kring
Trusted Enthusiast

Great idea!

 

Until this is implemented, you can use the OpenG “Array of VData to VCluster” VI (as shown here) to do the same thing.

 

peos
Member

This might be an alternative. Or, is typecasting dangeruos to use?

 

Alternative

LukeASomers
Member

We just came across the need to do something like this (in our case, it was common initialization before treating elements very differently). If you need to, you can bundle the cluster type into a new anonymous cluster, replace its contents with the sorted array-to-cluster result, and unbundle it.

 

Remember this cluster prototype.PNG

GregSands
Active Participant

If you're brave/silly enough to use an XNode, I wrote one a while back to do just this: https://lavag.org/topic/14422-array-to-cluster

 

Which means this idea is likely a duplicate of http://forums.ni.com/t5/LabVIEW-Idea-Exchange/Array-To-Cluster-Function-add-Type-to-Convert-Cluster/... (or vice versa based on date).

 

 

Alexander_Sobolev
Active Participant

I think this idea needs second life. Typecast and variant solutions do not work when cluster is from strings.

Current Cluster to Array + Variant to Data gives names to the cluster elements, but still requires correct size in Cluster to Array.

AristosQueue (NI)
NI Employee (retired)

Use the "Coerce To Type" primitive, added in LabVIEW 2018.

(Not the same as marking this idea as Complete, but it completely solves the problem of going through variants.)