Variant Data

LabVIEW 2013 Help

Edition Date: June 2013

Part Number: 371361K-01

»View Product Info

Sometimes you may need a VI to handle data of many different types in a generic way. You could write a different VI for each specific data type, but having copies of your VI is hard to maintain, since if you change one you have to remember to change all of them. LabVIEW provides the variant data type as one solution for these situations. The variant data type is a generic container for all other types of data in LabVIEW. When you convert other data to a variant, the variant stores the data and the original data type of the data, which allows LabVIEW to correctly convert the variant data back to the original data at a later time. For example, if you convert string data to a variant, the variant stores the text of the string and an indicator that says that this data was originally a string (as opposed to a path or an array of bytes, or other possible LabVIEW types).

Use the Variant functions to create and manipulate variant data. You can convert flattened data and LabVIEW data to variant data and convert variant data to LabVIEW data.

The variant data type allows you to store attributes of the data. An attribute is information about the data that you define and the variant data type stores. For example, if you want to know the time when a piece of data was created, you can store the data as variant data and add an attribute called Time to store the time string. The attribute data can be of any type. You also can delete or retrieve attributes from variant data.


Not Helpful