eberaud Posted January 11, 2017 Report Share Posted January 11, 2017 I was shocked to see that LabVIEW manages to execute this code properly. Can anybody explain why it works? Aren't clusters and arrays 2 different things? Quote Link to comment
drjdpowell Posted January 11, 2017 Report Share Posted January 11, 2017 A cluster is a fixed-size array. I often use this to convert clusters (of mixed types) into an Array of Variants. 2 Quote Link to comment
hooovahh Posted January 11, 2017 Report Share Posted January 11, 2017 21 minutes ago, drjdpowell said: A cluster is a fixed-size array. I often use this to convert clusters (of mixed types) into an Array of Variants. I use this feature all the time to make code more reusable, being able to find all labels, data types, and values of each element in a cluster quite easily. It's getting back that can be more tricky, where you need to take the array of variants, turn it into a cluster (using the array to cluster setting the size correctly) then a variant to data going from the variant to the cluster. I made an XNode for it a while ago that just sets the cluster size as you wire it up. Quote Link to comment
eberaud Posted January 11, 2017 Author Report Share Posted January 11, 2017 Uhm, If I reall y want/need to understand this I guess I need to dig into type descriptors and so on? Quote Link to comment
drjdpowell Posted January 12, 2017 Report Share Posted January 12, 2017 (edited) 12 hours ago, Manudelavega said: Uhm, If I reall y want/need to understand this I guess I need to dig into type descriptors and so on? Type descriptors? No. There are VIs such as “Get Type Information.vi”, which give you the info. Type descriptors come with flattening data, and flattening/unflattening data is slow. The various Variant functions are much faster. Edited January 12, 2017 by drjdpowell Quote Link to comment
eberaud Posted January 12, 2017 Author Report Share Posted January 12, 2017 Thanks for all those answers! Quote Link to comment
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.