LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

Accessing cluster elements from a cluster reference

I am passing a cluster reference to a subvi. In the subvi I would like get/change values of individual elements of the cluster. How do I get/change value an element by name? When I use unbundle by name I get wire error. 

girish53_0-1675975094604.png

Thank you.

Girish

0 Kudos
Message 1 of 8
(1,551 Views)

You can feed that reference into a property node and use the Value property to read/write data.

Matt J | National Instruments | CLA
0 Kudos
Message 2 of 8
(1,542 Views)

When I connect to a property node, I don't get the list of elements in the cluster. 

girish53_0-1675976906671.png

I have elements like baud rate, parity etc. which do not show up in the choice list. What is the property Value anyway? 

Girish

0 Kudos
Message 3 of 8
(1,522 Views)

The reference is a pointer to some cluster on a front panel. The Value property is the value of that cluster. You should be able to right-click what you have and change to read and then unbundle the Value output of the property node.

Matt J | National Instruments | CLA
0 Kudos
Message 4 of 8
(1,513 Views)

You need to use the type def to tell the subVI what's in your cluster.

ZYOng_0-1675981375959.png

 

-------------------------------------------------------
Applications Engineer | TME Systems
https://tmesystems.net/
0 Kudos
Message 5 of 8
(1,481 Views)

@ZYOng wrote:

You need to use the type def to tell the subVI what's in your cluster.

ZYOng_0-1675981375959.png

 


That's true for generalized cluster references, but not for "Strict" references.  It depends on the reference and how it was copied around.

0 Kudos
Message 6 of 8
(1,461 Views)

@girish53 wrote:

When I connect to a property node, I don't get the list of elements in the cluster. 

girish53_0-1675976906671.png

I have elements like baud rate, parity etc. which do not show up in the choice list. What is the property Value anyway? 

Girish


Change that Value property to "Read", then wire it to an unbundler.

"If you weren't supposed to push it, it wouldn't be a button."
0 Kudos
Message 7 of 8
(1,402 Views)

@Kyle97330 wrote:

@ZYOng wrote:

You need to use the type def to tell the subVI what's in your cluster.

ZYOng_0-1675981375959.png

 


That's true for generalized cluster references, but not for "Strict" references.  It depends on the reference and how it was copied around.


This is a possible race condition though, generally not 100% safe as other code accessing the cluster (read or write) can act on the data in the time period between reading and writing via property node in your diagram.

0 Kudos
Message 8 of 8
(1,362 Views)