02-13-2017 02:23 PM
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?
Solved! Go to Solution.
02-13-2017 02:45 PM
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.
02-13-2017 02:51 PM
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.
02-13-2017 03:35 PM - edited 02-13-2017 03:36 PM
crossrulz and RavensFan
Thank you, your suggestion worked. However, I feel I didn't implement it in the correct way.
Additional questions:
02-13-2017 04:02 PM
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".
02-13-2017 04:05 PM
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)
02-13-2017 04:11 PM
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:
Sincerely, kosist90
02-13-2017 04:22 PM
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.
Thanks,
02-13-2017 04:24 PM - edited 02-13-2017 04:29 PM
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.