LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

Array of cluster of arbitary type

Solved!
Go to solution

Hi all,

 

Is it possible to generate an array of cluster with the following characteristic?

 

1. each element cluster in the array will be of different type

2. depending on the code, each element could be a different data type at different time.  For example, the cluster at array[0] will be a string when the user input is one, and array[0] will be a U16 if the user input is two.  The index for a particular datatype is arbitary.

 

Let me know.  I am trying to write a subvi that will get an array of U16 convert the array to an array of cluster with string, U16, double, single, U32, etc.

 

Yik

------------------------------------------------------------------

Kudos and Accepted as Solution are welcome!
0 Kudos
Message 1 of 3
(2,293 Views)
Solution
Accepted by topic author jyang72211

Yes.  Use an array of variants.

 

You use the To variant to turn your data type into a variant to store in the array.  You use Variant to Data to convert the variant back to the original datatype, you just need to specify the datatype.

Message 2 of 3
(2,290 Views)

That would work great.  Thanks!

 

Yik

------------------------------------------------------------------

Kudos and Accepted as Solution are welcome!
0 Kudos
Message 3 of 3
(2,282 Views)