LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

Why are variants sometimes better to use than clusters?

I am using variants in a driver I am developing to avoid having to pass a ton of wires between subVIs. My mentor asked me why I was doing this. He wanted to know why I wasn't just using clusters. The only answer I could come up with was that is was convenient to be able to "dereference" (I'm not sure if this is the correct term) the variant for attributes with the Get Variant Attribute VI and a string associated with the attribute of interest. Are there any other advantages of using variants?
0 Kudos
Message 1 of 3
(3,082 Views)
I am not sure what you are trying to do, but I may agree on using clusters. It is a cleaner approach.

JLV
Message 2 of 3
(3,082 Views)
Yes! Variants are great when you are trying to write code that must operate on many different data types. However there are caveats that make error handling more difficult and critical. Take a look at the OpenG LabVIEW Data Tools, which make Varaint usage practical. This library is part of the OpenG Toolkit.

LabVIEW Data Tools Presentation - variants, run-time type checking, and data manipulation design patterns

Examples:

0 Kudos
Message 3 of 3
(3,082 Views)