06-05-2009 11:34 AM
I am trying to create the equivalent of a struct within LV. I believe using a cluster is the route to go but I don't have much experience with them. I would like to define and initialize a group of variables and then reference them by name further along in the code. Any suggestions?
Thank you,
Stephen
06-05-2009 11:37 AM - edited 06-05-2009 11:39 AM
Oh man.... another text programmer
I'm just kidding.
You can bundle the 'variables' into a cluster.
Then you can reference the cluster later in the code, and unbundle it to access the various parts.
06-05-2009 11:49 AM
char message[5]={'T','h','a','n','k','s'};
for (i; i <=5; i++)
{
Write(message[i]);
};
Just kidding. Thanks for that, I was trying to get this to work yesterday but it kept unbundling with only one name (the first variable placed in the cluster box). It was happening because I needed to name the rest of the variables before unbundling the cluster.
06-05-2009 12:39 PM
06-05-2009 01:07 PM - edited 06-05-2009 01:12 PM
Hi,
either resize the "unbundle by name" function to show more/all cluster elements or use the simple "unbundle" function which always shows all elements (but not by name).Or click the element name in the "unbundle by name" function to select a different element...
And please try to use LabView names (cluster instead of "struct", cluster element instead of "variable") as it will be a lot easier to understand your question and to provide help
06-05-2009 01:11 PM
STRUCT => CLUSTER;
it is usually best to make your clusters as typdefs and use bundle/unbundle by name
which is like
struct.field = value this is bundle by name.