LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

How to update cluster varible after indexing through a loop?

Solved!
Go to solution

I need help updating my cluster varible after indexing it through a for loop.

 

I have multiple cluster variables which I bundle into an array. I index the array in a for loop and check to see if for each cluster variable needs to be updated. If it is updated, I multiply the data value by 10. I want to update the data of that cluster to show the new value (old data * 10).

 

How can I do this?

 

UpdateClusterDataInLoopIssue.png

0 Kudos
Message 1 of 9
(4,146 Views)

You've done the work, now you have to "output" the work.  Right now you aren't doing anything with your updated data.  Just wire the output of the Bundle by Name out to the edge of the For Loop and pass it on from there to whatever code gets it next.

0 Kudos
Message 2 of 9
(4,129 Views)

Use an Autoindexing Tunnel for an output of the FOR loop, Index Array to get your individual clusters.  Assuming this is a subVI, write to indicators.


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
0 Kudos
Message 3 of 9
(4,118 Views)

crossrulz and RavensFan

 

Thank you, your suggestion worked. However, I feel I didn't implement it in the correct way.

 

Additional questions:

  • How I have is such that after ever iteration of the loop, the respective data is updated right away. Currently, all the data updates at the end of the entire loop.
  • I had to create a local variable and manually map out each of the indexing. Is it possible to do this automatically? 

UpdateClusterDataInLoopIssue-v2.png

0 Kudos
Message 4 of 9
(4,094 Views)

Hi aab-ufl,

 

Your question is a little bit unclear, I don't think anyone knew you wanted to modify the values of the input controls. As far as automatically, you do not need to specify the indices explicitly on "index array", it will start at 0 and increment with each output. Or, if you wire the first with "n", the next will be "n+1" and so on. 

 

Perhaps you should reconsider your datatype so you are working with arrays, if you want each element to go where you want it "automatically".

0 Kudos
Message 5 of 9
(4,087 Views)

First of all, remove the loop delay.

Second, use an array of clusters on the front panel, resized to show four elements. Now you only need to write to a single local variable at the end.

 

(You also don't need to wire indices of index array if you want the elements in order)

0 Kudos
Message 6 of 9
(4,080 Views)
Solution
Accepted by topic author aab-ufl

If you want to update controls values, you can use not just local variable, but property nodes - and references to controls; check VI snippet below:

 

Controls update.png

 

Sincerely, kosist90

logos_middle.jpg

 

0 Kudos
Message 7 of 9
(4,073 Views)

kosist90

 

Wow thank you very much. Your solution worked! The other solutions such as "create array of clusters on the front UI" wasn't feasible for what I wanted to acheive. Using Reference/Proprety NOde got the job done. 🙂

 

Attached is solution for others that might have similar issue.

 

UpdateClusterDataInLoopIssue-v3-solution.png

 

Thanks,

0 Kudos
Message 8 of 9
(4,067 Views)

altenbach wrote:

Second, use an array of clusters on the front panel, resized to show four elements. Now you only need to write to a single local variable at the end.


Here's how you would use an array of clusters. Keep it simple!

 

 

And if you want to update with every iteration of the loop, just do something like this. It is significantly cheaper to just rewrite the entire array than to use tons value property nodes.

 

Message 9 of 9
(4,065 Views)