ni.com is currently experiencing unexpected issues.

Some services may be unavailable at this time.

LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

extract cluster element names and values automatically

Dear Labview forum,

I would like to extract cluster element names and values automatically without prior knowledge of the cluster element size or contents.
I am able to extract the names but have some trouble with the values.  (see attached VI)

I wish to write each the cluster element name and value in a string, and then write the string to a new line in a file.

Regards,
Jamie
Using Labview version 8.0
Message 1 of 6
(7,704 Views)
This can become arbitrarily complex, because a cluster can contain many types of data, even other clusters, arrays, typedefs, etc. So getting a "value" of an element is not as easy as you might think. There is a reason you get a variant. 😉
 
If all cluster elements are simple numerics you can use "variant to data" with the correct type. The attached shows a few possibilities. Modify as needed.
Message 2 of 6
(7,693 Views)

Hi,

It will be better that ur question is a little bit clear.

I think ur query is regarding how to get the cluster element values?

The vi below will be helpful for u

 

Regards,

Padmavathi B  (GroupMember)

0 Kudos
Message 3 of 6
(7,692 Views)
Parsing all the different data types to be able to write it to a file is a lot of work.
Luckily, the work has already been done - You can go to the OpenG site and download the Variant Configuration VIs which allow saving and loading clusters to text files. See here for an example.

___________________
Try to take over the world!
0 Kudos
Message 4 of 6
(7,690 Views)
Another example using the OpenG toolkit is found here

Ton
Free Code Capture Tool! Version 2.1.3 with comments, web-upload, back-save and snippets!
Nederlandse LabVIEW user groep www.lvug.nl
My LabVIEW Ideas

LabVIEW, programming like it should be!
0 Kudos
Message 5 of 6
(7,684 Views)
Hi all,

altenbach's solution was what I was looking for.  The openG options I haven't yet explored.

Thanks for everyones' help.

Regards,
Jamie


Using Labview version 8.0
0 Kudos
Message 6 of 6
(7,674 Views)