LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

what is variant data?

Could someone please explain to me what is variant data. I want to write data to an excel file. it can either be done while I am collecting data (simultaneously) or after the data is collected. Thank-you,
Ivanka
0 Kudos
Message 1 of 5
(3,331 Views)
Variables usually have a certain data type associated with them, like boolean or numerical or string. A variant data type can be any data type. There is a function that converts variant data to a specific data type or vice versa. Variants are used when passing data to another module where the data type is unknown or can be anything. An example is reading fields in a database. Table 1 may contian a string and a number, whereas Table 2 may contain a number and a date. variants are used here since the data type differs from one table to another. Variants take up more memory since it must accomodate for the largest data type possible. When using variants, at some point you must know what to convert it to, so you must know that Table 1 column 1 has a string an
d column 2 has a number, and so on, or you would not be able to act upon that data (like adding numbers or concatenating strings).
- tbob

Inventor of the WORM Global
Message 2 of 5
(3,330 Views)
Thanks,
So if I am only planning to store decimal numbers in an Excel file, I don't need to use variable conversion node, right?
Ivanka
0 Kudos
Message 3 of 5
(3,330 Views)
I've never stored directly to Excel, but I do believe that you can store a number directly to Excel without converting to a variant. Try it to make sure.
I usually store data in a comma separated variable (csv) file, which Excel can open. I find it easier to use and more flexible, and I can use any text processor to open it also. Also a csv file is smaller since it doesn't have the Excel overhead.
- tbob

Inventor of the WORM Global
0 Kudos
Message 4 of 5
(3,330 Views)
here is a document that describes variants, in one of its sections.
0 Kudos
Message 5 of 5
(3,330 Views)