LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

Cluster to string

Hi

I'll send you the LLB including the VI's to decode LV5.1.1 structures (about
500kB zipped so not attached to the newsgroup). I hope all sub VI's are
included.

Two examples are included:

TEST2 will simply convert the variable to a string. Try to write something
in the 'section' variable and see the difference.

TEST3 will convert a variable to a string, write it to a configuration (ie
text) file and read it back to a new variable withe the same structrure and
name.

Have fun

Hans
0 Kudos
Message 8 of 22
(2,492 Views)
Would you also forward me a copy of LV_STRUCTURE_DCODER.LLB. I am working with LV 6.1 so I am not sure how well it will work but it would definitely give me ideas to write my own routine.
Thanks in advance.
OS (oas@stress.com)
0 Kudos
Message 12 of 22
(2,423 Views)
HI together,

could anybody send me the "LV_STRUCTURE_DCODER.LLB" to my mail (see attachment) or maybe in the meanwhile is there
any new solution for this problem?

Thanks Thomas.
0 Kudos
Message 13 of 22
(2,074 Views)
Hi RB,
      See EXAMPLE in the attached LLB.  It's supposed to decompose arbitrarily complex Clusters into an INI-stye format text, however, it's much more readable if the cluster is composed of atomic-types (Numeric, String, Bool) because some "syntax" was needed to keep track of nesting.  It's a work in progress and by no means "road-tested" - but maybe you can change the output format to meet your needs.
 
Cheers!

Message Edited by Support on 01-24-2007 11:40 AM

"Inside every large program is a small program struggling to get out." (attributed to Tony Hoare)
0 Kudos
Message 14 of 22
(2,070 Views)
Hello,

that's nearly that what I searched. The only problem is, that I cannot connect to the example.vi as subVI
any kind of cluster. I tried it with variant conversion but then, the VI doesnt' work anymore.
Isn't there any simple trick to connect any kind of cluster to the example.vi?

Thanks, Thomas.
0 Kudos
Message 15 of 22
(2,065 Views)

Hi Thomas,

      If you replace the Cluster in Example.VI with on of your own, it should work.  But, here's another LLB with a Wrapper which takes a Variant input - so you can wire anything to it! Smiley Happy

Please keep in mind that this code is very new and I expect will need some more work! Smiley Wink

Cheers.

 

Message Edited by Support on 01-24-2007 11:39 AM

"Inside every large program is a small program struggling to get out." (attributed to Tony Hoare)
0 Kudos
Message 16 of 22
(2,056 Views)
** First Post Alert **
 
Hi to All!  I found this thread searching out how to write a cluster to a text file.  It turns out that this is easily done using an OpenG package. Check this link:  http://forums.ni.com/ni/board/message?board.id=170&message.id=218523&requireLogin=False     I know, I know you want to convert the cluster to a string. 🙂  Well, you could read the text file back in as a string.  Or you could take a look at the Source vi, "Write INI Cluster".
 
B_Yeske
 
P.S.  Thanks for VIPM, Jim Kring!
0 Kudos
Message 17 of 22
(2,010 Views)
The OpenG subroutine is amazing, it saves *a lot* of time.
I attached an example (using LV8.2.1) for a little improvement (maybe it is already possible to do that).
 
PROBLEM:
If I have a menu ring in the cluster, the openG function write the number insted of the "string value".
I want to have the string value of the menu items
The result ini file of my example is this:
 
[Setup-1]
SCL=1.0
OS1=0.0
OS2=0.0
OAU=1.0
INP=1
T2=0
DS=0
 
but I want INP=ST1 and SCL=2°C. Is that possible? any idea using some openG power-tools?
 
 
0 Kudos
Message 18 of 22
(1,892 Views)

A ring's value is only the number. The strings are only used for the display part, so once you put the ring into the cluster, you don't have any real way of extracting the strings.

The strings can be extracted from the control itself by creating a property node (right click on the control or the terminal and select Create>>Property Node) and selecting the Strings[] property, but you can't use that in the OpenG code, because it only accepts the numeric value of the ring.

If you want another option, the easiest option is probably to use a combo box (in the string palette) which is similar to the ring, but has a datatype of string.


___________________
Try to take over the world!
0 Kudos
Message 19 of 22
(1,883 Views)
I have been struggling with this issue of cluster (or any control type) serialization.  In languages like java and .net complient languages the Object pase class has a method toString().  A to string function does exactly this.  It would be nice if in future versions a tostring, fromString is implemented right into the gObject so a general method of serialization is possible.  This function could handle all data types including arrays and clusters.  Flatten to string is close to this but it is not nice for init files and data saving.
Paul Falkenstein
Coleman Technologies Inc.
CLA, CPI, AIA-Vision
Labview 4.0- 2013, RT, Vision, FPGA
0 Kudos
Message 20 of 22
(1,873 Views)