Showing results for 
Search instead for 
Did you mean: 

How to separate a variant?

Go to solution

Using the DAQmx Counter - Read Pulse Duty Cycle and Frequency example, the data is stored in a variant with both duty cycle and frequency. If you want to separate the two values so they are each an independent array, how do you accomplish that? I've tried indexing the array, which only removes a single pair of values, and not one of the sets. Then, I though to use get variant attribute, but that didn't work either.

0 Kudos
Message 1 of 5
Accepted by topic author randomguy77

The example VI I'm looking at doesn't have a variant.  It has an array of clusters.  Each cluster has the duty cycle and frequency.  So you just need to index and unbundle.



0 Kudos
Message 2 of 5

It depends on how the data is stored, but I'm guessing it is the Variant to Data you are looking for.  You specify the data type of the variant and then the output is the data in that format.  Of course this only works if the data type is correct and if it is wrong it will generate an error.  It is odd to me that this function doesn't just return the data in the native data type.

0 Kudos
Message 3 of 5

Ah that is what it is then. My first thought was that it was a cluster, but I didn't index them first when I tried to unbundle, and so got an error on the wire. Thanks.

0 Kudos
Message 4 of 5

Just hover over the wire or the terminal with context help turned on, or look at the indicator on the front panel and it will et you know how the data is structured.

0 Kudos
Message 5 of 5