LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

how to convert varaint to string


Hello,

 

I have attached the VI please have a look 

 

There is block called get waveform components from where I am taking time , Data and Attributes.

and data Attributes is in form of strings, which I Need to convert in string to store in text file

0 Kudos
Message 11 of 16
(949 Views)

@vishal231 wrote:


Hello,

 

I have attached the VI please have a look 

 

There is block called get waveform components from where I am taking time , Data and Attributes.

and data Attributes is in form of strings, which I Need to convert in string to store in text file


data Attributes isn't in form of strings.

 

Use "Get Waveform Attribute" function. It get's the attributes as a set of names and variants.

 

Pretty sure you'll get exactly the same names and variants if you use Get Variant Attribute from the unbundled variant of the waveform.

 

In the variant it looks like a string, but that is just visualization. You need to convert all the attributes, of different types to string.

 

Use the suggested formatPropertyList.vi for a quick start...

Message 12 of 16
(944 Views)

Hi vishal,

 


@vishal231 wrote:

I have attached the VI please have a look 

 

There is block called get waveform components from where I am taking time , Data and Attributes.

and data Attributes is in form of strings, which I Need to convert in string to store in text file


The VI you attached does not contain the code as shown in your last image.

 

When the "attributes" already contain strings, then why do you need to convert to string???

Best regards,
GerdW


using LV2016/2019/2021 on Win10/11+cRIO, TestStand2016/2019
Message 13 of 16
(943 Views)

@GerdW wrote:

When the "attributes" already contain strings, then why do you need to convert to string???


I get the confusion: if it looks like a string it must be a string. It's not...

 

That variant has attributes. These attributes are displayed as strings (by LabVIEW). That doesn't make the variant a string. In fact, the variant value is probably empty (void). It is just used as a container for the attribute set.

 

It's actually near impossible to get the string that is displayed in a variant indicator. Replicating the string is the next best thing, but bloody annoying. Use the TDMS VI as a starting point...

Message 14 of 16
(934 Views)

hello,

thnaks for reply

 

You said to use TDMS VI , Do I have to create TDMS file ? and save the data in TDMS Format?

0 Kudos
Message 15 of 16
(901 Views)

What wiebe meant is the formatPropertyList.vi. It is part of the TDMS file viewer vi, but can be used separately.

To get something similar to the probe view, you have to format every property individually into a string. formatPropertyList.vi shows you how to do that. The format might not be what you want, so make a copy of that vi and adjust it however you want. Here is how to use it:

FormatWaveformAttributes.png

 

 

Message 16 of 16
(879 Views)