LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

How do you write the content of a Variant to a File Excel

How do you write the content of a Variant to a File Excel

0 Kudos
Message 1 of 8
(4,126 Views)
It would probably be best to use the variant to data function then feed that into a write to measurement VI.

It all kind of depends on what your variant is.
Matt J | National Instruments | CLA
Message 2 of 8
(4,109 Views)

Are you talking about the variant data or variant attributes (or both)?

 

Excel is a proprietary microsoft format. Easiest would be to use "variant to data" and then use the report generation tools for excel. What is the data structure?

Message 3 of 8
(4,102 Views)

Well there are many ways people have came up with for converting a variant to a string.  OpenG and MGI both have a read/write anything to an INI format which in the low level of the code generally means converting each of the expected data types to a specific format.  This makes the data structure more readable, but increases the file size needed, compared to a binary write.  If you want to write something yourself I'd start with one of these.

Message 4 of 8
(4,093 Views)

 Thanks MattJ and Altenbach for your response. Sorry i wasn't clear before It is the attributes as they update in the Variant  in the variant. I have Strings and Decimal numbers and Names thats constantly being updated at random times. What would be best to write it to a file. I do not have report generation tool kit.

0 Kudos
Message 5 of 8
(4,091 Views)

thanks for your reply i will check that out.

0 Kudos
Message 6 of 8
(4,089 Views)

Does it need to be a human readable formatted file? (Any formatted file typically converts numbers to decimal and the data is never exactly identical to the original binary representation)

 

What's the purpose? If you just want to save the variant (including all data and attributes), just write it to a binary file. Later you can retrieve it and get everything back unchanged. Works beautifully!

 

 

 

Message 7 of 8
(4,072 Views)

I will try that out and if i have any issues i will come back for help, but if it works i will also let you'll know. Thanks for your help.

0 Kudos
Message 8 of 8
(4,061 Views)