LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

Is it possible to convert from string to variant?

Hi!
 
I would like to convert a text string to variant. I'm doing this because I would like to merge a couple of signals and then save all the signals in a lvm-file. Could someone please explain how to convert from text to variant, is it possible?
 
Thanks in advance!
Regards,
Mattias
 
 
 
 
0 Kudos
Message 1 of 7
(4,878 Views)

Matthias

Couldn't you just use the Merge Signals.vi and not worry about variants?

David

0 Kudos
Message 2 of 7
(4,870 Views)

Sorry poor answer just looked at your JPG

David

0 Kudos
Message 3 of 7
(4,870 Views)

Whats in the string data? Maybe you can convert it to a number or array then use to the Convert to DDT function

David

0 Kudos
Message 4 of 7
(4,864 Views)
What you are attempting to do is possible, but might not give you the results you expect.  All you need to do is convert your string to an array of U8s using the String to Byte Array conversion primitive.  In the file, you will get a single character per line of the file expressed as the ASCII code.  When you read it, convert to U8s, then use Byte Array to String to get your string back.

You may also want to read up on LVM files.  There are several places to put strings that work a little better than this.
0 Kudos
Message 5 of 7
(4,845 Views)
Rather than trying to cram the text into a signal format, you could just put it in the Comment terminal of your Write to Measurement File.
0 Kudos
Message 6 of 7
(4,833 Views)

Thanks for your good advices. I have now connected my string to the comment terminal and it works fine.

Regards,

Mattias

0 Kudos
Message 7 of 7
(4,828 Views)