LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

LV Queues

Can a LabView queue hold elements other than a string? If so, how do you set
the element type?

Thanks...Ed
0 Kudos
Message 1 of 7
(3,347 Views)
afaik, only strings are allowed but you can use the number to string or the flatten to string functions to get around this.
0 Kudos
Message 2 of 7
(3,347 Views)
The LabVIEW help specifically lists strings as the input and output from the queue VIs. Convert everything to string to use these.

Rob
0 Kudos
Message 3 of 7
(3,347 Views)
Do I have the answer for you! Cast anything to a variant then to string and recover everything from the other end. Enjoy.
Zuolan
0 Kudos
Message 4 of 7
(3,347 Views)
Why cast to variant first? You can flatten/unflatten data to/from a string without converting to a variant first.
0 Kudos
Message 5 of 7
(3,347 Views)
A shortcut would be to wrap the "Insert Queue Element.vi" in a VI that have a Variant input instead of a string input. This way the typecast to variant is transparent (except for the coercion dot). In that VI there are two ways to flatten to string before calling Insert Queue:

Variant to Flattened String: the flattened string of the content of the variant is insert to the queue (no type descriptor).

Flatten to String: if the variant itself is flattened to string. The difference is that now the type descriptor of the content is also included in the string along with the flattened content. This can be handy to actually determine what is actually in the string when removing a queue element. After removing, Unflatten to a variant indicato
r visually displays the data content and is useful for debugging. Variant to Flattened string can then be used to extract and parse the type descriptor to typecast the content to its datatype.

Jean-Pierre


LabVIEW, C'est LabVIEW

0 Kudos
Message 6 of 7
(3,347 Views)
This is part of a more complex scheme. You can add attributes to the variant and at the receiving end this information will allow you, for example, to determine how to decode the variant. A simple application would be having a generic queue where objects of one of several types can be mixed up in a queue in random order and still retreived correctly by the receiver.
Zuolan Wang
0 Kudos
Message 7 of 7
(3,347 Views)