LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

Reading an array data type that has been bundled in a cluster and converted to variant

Solved!
Go to solution

@LucianM wrote:

Get Cluster Information.vi returns an array of variants each containing the elements type and not the values. You need to store the flatten string form of the original data as well to be able to convert it back:

Get Cluster Information.png


 

Thanks! That makes sense.

0 Kudos
Message 11 of 13
(395 Views)

@billko wrote:

@pablo.doc wrote:

So I've found a workaround. It turns out you can convert the cluster into an array of variants first and this works, although I find it a bit inelegant. I'm still unsure of what was wrong with my original thinking.

snippet_fixed.png


You are wrapping your data within a cluster.  You need to decode it the same way:

convert.png

 

Edit:

Oops, I see you wanted it as an array.  Forget the FOR loop.


 

That, unfortunately, requires knowing the cluster, so won't be able to solve for a generic cluster which is what I was after; it kind of misses the point of using the variant data type.

 

Perhaps I should have rephrased my question slightly. In any case, using the 'get cluster information' gives the cluster type, which you can then use to convert the data back into something usable.

0 Kudos
Message 12 of 13
(392 Views)

You don't need 'get cluster information' at all.  Just use 'variant to data' with an array of variants as the type.

0 Kudos
Message 13 of 13
(364 Views)