LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

using clusters with local variables

I am trying to create a cluster that contains indicators of which I have created local variables. Whenever I put my indicators into my cluster on the front panel, my local variables disappear.

Can I not use variables and clusters with the same indicator?

If I can, how do I?
0 Kudos
Message 1 of 11
(6,416 Views)
As soon as you move an indicator into a cluster, that indivdual indicator is then part of the cluster indicator and can't have it's own local variable. The cluster can have a local variable and if you have to use locals, use that. Just use the bundle/unbundle functions to write/read values to the cluster's local variable.
0 Kudos
Message 2 of 11
(6,416 Views)
I'm trying to pass information from one state of a state machine to another. Currently, I am doing this using local variables, however, I have been told that clusters would be efficient.

If I create a cluster, then how do I get the values from, for example state 2, to state 3 and then to state 5.

In state 2, I am reading initialization values from a file. In state 3, I am using these values to calculate a reading from a signal. In state 5, I store data.
0 Kudos
Message 3 of 11
(6,416 Views)
You pass the values from one state to the next by using a shift register that passes through all states. You don't need locals at all. In the states that you update values, use the bundle by name function to change just the cluster elements you want. In the states where you read values, use the unbundle by name function.
Message 4 of 11
(6,416 Views)
Terry,

There is an example of how to do this in the Discussion Topic: "LabVIEW Programming Design Discussion Thread and Samples" under the Sample Designs thread.

The shift register is how you move the data, not the local variable. The cluster is used to bundle all of your data into a single dataset that you pass through the shift register, as shown in the example. This technique allows you to scale your data so that you don't have to add a shift register (and wire it through every case) everytime you need to add data.
0 Kudos
Message 5 of 11
(6,416 Views)

@Labviewguru...hopefully you are still active here.

 

I can not find the threads you mention here. Can you help me out with a link? I have been looking for this specific example for some time.

0 Kudos
Message 6 of 11
(2,423 Views)

You create a local variable to the cluster element

 

Edit, I see I forgot to look at the original post date from 20 years ago.

 

The shipping examples will have a simple state machine example.

 


"Should be" isn't "Is" -Jay
0 Kudos
Message 7 of 11
(2,416 Views)

@JÞB wrote:

You create a local variable to the cluster element

 

Edit, I see I forgot to look at the original post date from 20 years ago.

 

The shipping examples will have a simple state machine example.

 


I think this ties the record for oldest resurrected zombie thread.

Bill
CLD
(Mid-Level minion.)
My support system ensures that I don't look totally incompetent.
Proud to say that I've progressed beyond knowing just enough to be dangerous. I now know enough to know that I have no clue about anything at all.
Humble author of the CLAD Nugget.
0 Kudos
Message 8 of 11
(2,405 Views)

lol, 20 years is pretty long ago.  But I still don't have the example. The shipped Simple State Machine doesn't use a cluster as described above.  I know I've seen this implemented very cleanly, but I can't remember specifically how it was done. I'd love to find a exemplary vi.  

 

 

**Update - It does include the cluster...my mistake.  This thread can continue to Rest In Peace

0 Kudos
Message 9 of 11
(2,386 Views)

Close... but no cigar.   Missed the (AFAIK) record by about a year and a half, putting it in 4th place (again, AFAIK).

 

 

-Kevin P

ALERT! LabVIEW's subscription-only policy came to an end (finally!). Unfortunately, pricing favors the captured and committed over new adopters -- so tread carefully.
0 Kudos
Message 10 of 11
(2,376 Views)