From 04:00 PM CDT – 08:00 PM CDT (09:00 PM UTC – 01:00 AM UTC) Tuesday, April 16, ni.com will undergo system upgrades that may result in temporary service interruption.

We appreciate your patience as we improve our online experience.

LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

How to change the specific element value of a cluster

Solved!
Go to solution

Hi All,

 

I have a cluster which contains mostly string, I want to change a specific value of an element of that cluster. How can i do that.

 

attached is my vi, 

 

Thanks

0 Kudos
Message 1 of 5
(4,260 Views)

Hello AnkitG,

 

The second half of the "Arrays and Clusters" tutorial linked here will walk you through modifying individual cluster elements:

 

Getting Started with NI LabVIEW Student Training Module 5: Arrays, Clusters, and Text Based Nodes

http://www.ni.com/white-paper/7530/en/

 

I strongly recommend reading through that tutorial as well as any others you have time for, as this is fundamental concept in LabVIEW and you should have at least a basic understanding before developing complex applications.  If you have a current NI SSP contract, you should also have access to online self-paced training.

 

It looks like you've already been able to unbundle the element you want to modify, now you just need to branch the cluster wire and rebundle your modified value using the bundle by name function.  Refer to the tutorial linked above for additional information on modifying clusters.

 

Best Regards.

Tom L.
0 Kudos
Message 2 of 5
(4,256 Views)
Solution
Accepted by topic author AnkitG

Bundle By Name


GCentral
There are only two ways to tell somebody thanks: Kudos and Marked Solutions
Unofficial Forum Rules and Guidelines
"Not that we are sufficient in ourselves to claim anything as coming from us, but our sufficiency is from God" - 2 Corinthians 3:5
Message 3 of 5
(4,255 Views)

I know this is marked as solved but:

 

Do you have to unbundle and use substring? Is there any reason you can't just bundle by name with the new value going into the appropriate string input? The results are the same in the snippet below, but the top way uses less code. Or am I missing something?

0 Kudos
Message 4 of 5
(2,699 Views)

If you want to replace the entire string, your simpler solution is fine.

The old solution might be needed if there is an existing string and you want to replace part of it. (and in that case, I would ise an IPE structure anyway).

Message 5 of 5
(2,692 Views)