LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

The names and values out of Cluster

I'd like to take out the names and values of the elements in a cluster in a string form without unbundling. Acutally, it is very annoying to unbundle and change into string when a lots of clusters should be used.

Thanks
Message 1 of 7
(3,878 Views)
Not real sure what you are trying to ask here.

If you don't want to use the Unbundle functions, you can get to the cluster element values using a property node, but the Unbundle functions are far more efficient and using the property nodes would be just as annoying if not more so.

I don't think there is any other way to get at individule cluster elements.

If all the elements in the cluster are of the same data type, you can use the Cluster to Array function, then you could operate on the data in a For or While loop. This might make things a bit easier for you.

Can you provide more details on what you trying to do and exactly what is annoying you?

Ed


Ed Dickens - Certified LabVIEW Architect - DISTek Integration, Inc. - NI Certified Alliance Partner
Using the Abort button to stop your VI is like using a tree to stop your car. It works, but there may be consequences.
0 Kudos
Message 2 of 7
(3,878 Views)
Hi Grace,

You can actually pick a single element from the cluster. This way you do not have to unbundle the entire cluster.

In the Functions Palette, under "Cluster", place the "Unbundle By Name" icon on the block diagram and wire in the cluster. Use the "Operate Value" tool (the finger icon) and click on top of the right side of the "Unbundle by Name" icon. A selection will pop-up. Choose the element you wish to extract. The value of that element will be passed by wiring it within your vi.

JLV
Message 3 of 7
(3,878 Views)
Thanks, Dickens

What I wanted to do is to find the general way to extract the names and values of the elements IN A FORM OF STRING to save as the text form for any cluster. Untill now I have saved the Cluster by using Flatten TO STRING but you know its form is binary so I can't read that unless I did UNFLATTEN FROM STRING. It is impossible to get the data back alive when I change the cluster form and lose the previous form. That's why that I thought a way to save in a text form the names and values if necessary. I have a lots of clusters and have to unbundle and do something one by one to save the names and values. In a programming perspective, it is very inefficient and annoying.

Thanks
0 Kudos
Message 4 of 7
(3,880 Views)
Take a look at the OpenG Toolkit.
http://openg.org/tiki/tiki-index.php?page=OpenG%20Toolkit It has variant
configuration file vi's that will save clusters in ascii, as well as the
entire front panel.

"GraceSun" wrote in message
news:506500000005000000CC7B0100-1079395200000@exchange.ni.com...
> Thanks, Dickens
>
> What I wanted to do is to find the general way to extract the names
> and values of the elements IN A FORM OF STRING to save as the text
> form for any cluster. Untill now I have saved the Cluster by using
> Flatten TO STRING but you know its form is binary so I can't read that
> unless I did UNFLATTEN FROM STRING. It is impossible to get the data
> back alive when I change the cluster form and lose the previous form.
> That's why
that I thought a way to save in a text form the names and
> values if necessary. I have a lots of clusters and have to unbundle
> and do something one by one to save the names and values. In a
> programming perspective, it is very inefficient and annoying.
>
> Thanks
0 Kudos
Message 5 of 7
(3,878 Views)
HI Grace Sun
 
I have a problem similar to yours I think. I solved it half way. Im able to get the labels of the controls in the cluster out automatically. I use a property note to get the controls. The problem is however the values. The come as variants, which is necessary since the data type is different for different controls. My question is how I change variants to string. I think Im almost there but I cant get the type casting to work. I hope someone knows how this is done. I have put two links so that you can se an example of the code.
 
Best regards
Carsten
0 Kudos
Message 6 of 7
(3,764 Views)
OpenG
 
 
Jean-Pierre Drolet developed some really slick code that does what you want. Even if his stuff is not exactly what you need, you should take a look at how he solved the problems.
 
Ben
Retired Senior Automation Systems Architect with Data Science Automation LabVIEW Champion Knight of NI and Prepper LinkedIn Profile YouTube Channel
Message 7 of 7
(3,742 Views)