08-26-2010 06:02 PM
Hi all,
I am trying to accomplish a simple task, but I do not know if there is a simple solution or not. Here is my problem:
I have a main cluster that is made up of additional clusters (let's call them sub-clusters). These subclusters vary in size, ranging from 1 boolean element to 8 boolean elements.
Is there a simple way to index each sub-cluster inside a for loop? When I use the property node, the value of the sub-clusters is a variant which I would need to convert back to cluster datatype. I'm having trouble doing so b/c 'Variant to Data' requires a known cluster size to be defined. Since the sub-clusters vary in size, I cannot specify a fixed size. As is, I get ERROR 91 during the variant to dattype conversion process.
Thanks for the help!
Solved! Go to Solution.
08-26-2010 06:20 PM
I would probably be using a cluster of boolean arrays at this point, but since you asked you can do this with a little help from a VI buried within vi.lib:
08-26-2010 06:27 PM
I'm not sure what your final objective is, but I am guessing that you are wanting to get the boolean values from different clusters and combine them to form a digital waveform. Would the following example not work?
08-26-2010 07:09 PM
Hi Darin,
That is exactly what I am trying to accomplish. However, when I tried using the same approach, I notice that the 'Variant to Data' always produces a False. The number of elements being processed from each sub-cluster is correct, but I'm not getting the right values.
Hi tbob,
Your example works, but the main cluster I am working with contains 20+ sub-clusters. Unbundling each sub-cluster would involve using a lot of wires / whitespace. I wanted a simpler approach, such as by using for loops and property nodes if possible.
Thanks.
08-26-2010 11:30 PM
Ha Ha, I used a pretty lame test case.
I was writing it out the brute force way when I thought of the vi.lib VI. Here is the other way to do it in this case.
08-27-2010 01:44 AM - edited 08-27-2010 01:49 AM
Or something more straight with GetClusterInfo.vi from vi.lib/Utility/VariantDataType
08-27-2010 11:04 AM
Two posts that I watch out for during the day are the one I try to make while running out of the office and the one I make at night while trying to keep the kids distracted. You went two-for-two on this one.
Just use a Boolean array constant as the datatype for Variant to Data instead of the Cluster constant. I get dinged with so many errors with mismatched variants that I forget which cross conversions actually work....
A little caffeine goes a long way....