LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

Using variants to programmatically adjust an array of clusters

Solved!
Go to solution

I'm trying to use variants to build a polymorphic VI to replace four (at time of writing) separate subVIs that are essentially identical, except for the base type of the array.  Each takes in a 1D array of clusters, and resizes it by way of the following code:

17157iEA14D0918CDA7B18

 

Looking through my reference textbook, I found the unlisted (on the palette) VariantDataType directory (*\vi.lib\Utility\VariantDataType), and have been attempting to use a combination of them to do the following:

 

1.  Take a variant-ized array of cluster in.

2.  Convert the variant programmatically into the array of cluster, based on the information encoded in the variant.

3.  Perform the resize array operation, as above.

4.  Convert the output array back into a variant, and feed the indicator.

 

Attached are the two VI, and a sample control cluster I'm using.  I'm running out of ideas; any tips?

 

Using LabVIEW 2009.

UGNS StarSword
CMD-40C, United Galactic Navy
0 Kudos
Message 1 of 3
(2,887 Views)

Hey StarSword,

 

So it looks like from your snippet, you have the resizing of the array down. The hard part is bringing the variant type into the SubVI and using it. The preferred method to do this is to find each instance in the Main VI that you plan on converting a data-type to a variant and bundling it with a Ring Constant that is unique to each data type you use. With this, you can use the "Data Type Ring Control" to control a Case Structure, each case with a Variant to Data VI and the appropriate Type input for the data type.

 

You may also be interested in the forum post found HERE.

 

Logan H

National Instruments
Applications Engineer
0 Kudos
Message 2 of 3
(2,863 Views)
Solution
Accepted by topic author StarSword

Actually, I found an even better method.  You go to File>New, make a Polymorphic VI, and load instances of the various similar VIs into the Poly VI.

 

Here's the end result.

UGNS StarSword
CMD-40C, United Galactic Navy
Message 3 of 3
(2,835 Views)