LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

how to convert varaint to string

Hello People,

 

I am doing data logging

 

I am taking data from waveform and then saving all data to text file.

I am not able to convert data(variant) Attributes  to string to store in text file.

I Need variant to string conversion function , I tried using varaint to flattened string but it does not worked 

and even  flatten to string function 

Thanks in Advance😌

attached VI

 

Regards

Vishal 

0 Kudos
Message 1 of 16
(3,269 Views)
0 Kudos
Message 2 of 16
(3,260 Views)

Hi vishal,

 


@vishal231 wrote:

I am not able to convert data(variant) Attributes  to string to store in text file.

I Need variant to string conversion function , I tried using varaint to flattened string but it does not worked 

and even  flatten to string function 


What does not work? Where did you fail? Where's the attached VI?

You can read any variant attribute using the GetVariantAttribute function: what is your problem with this?

Best regards,
GerdW


using LV2016/2019/2021 on Win10/11+cRIO, TestStand2016/2019
0 Kudos
Message 3 of 16
(3,257 Views)

If you want a human readable form of the variant attributes, check out this vi: <labview>\vi.lib\Utility\tdmsutil.llb\formatPropertyList.vi

Feed it the output of Get Variant Attribute.

Message 4 of 16
(3,250 Views)

@cordm wrote:

If you want a human readable form of the variant attributes, check out this vi: <labview>\vi.lib\Utility\tdmsutil.llb\formatPropertyList.vi

Feed it the output of Get Variant Attribute.


Good one.

 

I'd copy that VI and modify it to suit my needs (you want need different name\value formatting).

 

Still not sure what OP wants. (S)he mentions attributes, but I think these are attributes of the TDMS file, so it would be about converting a variant value to string.

 

Variant To Data works if the variant value is a string, your suggestion converts other data types to string.

Message 5 of 16
(3,231 Views)

hello , 

 

Thanks for replying

here the VI,

 

I will be variant to be converted into string for storing in text file.

i guess get variant Attributes will give me variant only and still soversion will be left

0 Kudos
Message 6 of 16
(3,220 Views)

Hi vishal,

 


@vishal231 wrote:

here the VI,

 

There are no "variants" visible in the VI block diagram. I also don't see where you (attempt to) "convert variants to string"…

 


@vishal231 wrote:

i guess get variant Attributes will give me variant only and still soversion will be left


Why do you "guess" instead of "trying out"? Why don't you read the LabVIEW help on variant attributes and the functions to handle them?

How are variant attributes even related to your VI?

Best regards,
GerdW


using LV2016/2019/2021 on Win10/11+cRIO, TestStand2016/2019
0 Kudos
Message 7 of 16
(3,214 Views)

@vishal231 wrote:

Thanks for replying

here the VI,

 

I will be variant to be converted into string for storing in text file.

i guess get variant Attributes will give me variant only and still soversion will be left


Soooo many questions.

 

1st one: where are the variants?

0 Kudos
Message 8 of 16
(3,212 Views)

hello,

 

see the issue I have pasted 

 

 

0 Kudos
Message 9 of 16
(3,206 Views)

Hi vishal,

 

where exactly does that error occur?

Which function is highlighted when you select "stop"?

 

The code shown in your last image is different to your attached VI. When we should help on your code problems then you should attach that code!!!

Why is there no error handling in the inner FOR loop?

Why are there no inputs/outputs connected to GetVariantAttribute?

 

I repeat my question from above: Did you read the LabVIEW help for those variant functions?

Best regards,
GerdW


using LV2016/2019/2021 on Win10/11+cRIO, TestStand2016/2019
0 Kudos
Message 10 of 16
(3,202 Views)