LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

SubVI to copy variant attributes or to set an array of attributes to a new variant

Hey LV Forums!

 

I thought I'd share this little subVI I've made. At one point in time, I needed to copy all the attributes from one variant to another. Simple enough, really, but I figured someone might make use of it. Look, it even have error handling! Smiley Wink

 

The problem:

Set Variant Attribute accepts a variant array of values for the attributes, but not an array of names.

 

The solution:

Get Variant Attribute returns, when "name" and "default value" is unwired, an array of variant names and an array of variants (attributes) associated with those names. So we just take those, throw them into a for loop with shift register, and write them one-by-one to the new variant.

 

The Code:

Set Variant Attribute Array.png

 

The Example:

Set Variant Attribute Array example.png

Message 1 of 1
(2,221 Views)