04-21-2015 02:14 PM
I have a array of a cluster of 2 elements that I am trying to get an index number from, and then I am trying to get the index to center in the display on the front panel.
Can you assist?
Solved! Go to Solution.
04-21-2015 02:22 PM - edited 04-21-2015 02:26 PM
Your question makes little sense.
What is special about the index you are trying to "get"?
(Typically, You try to solve the inverse problems, gettting an array element given the index.)
What does the data represent? What kind of display (graph, array indicator, etc.)? What is the meaning of "center"?
Do the clusters represent 2D points with an x and y element? Do you want the index of the point (array element) that is closest to the mean of all x and all y?
Can you attach a simple VI containing some data and explain what you have and what you want? Thanks!
04-21-2015 02:38 PM
I have attached an image of the indicator. I am getting the operators' name at their stations, and I am wishing to compare their names to the cluster, and find the index that the name appears in, and then show their name in the center of the display. This is to show the operators where they compare to the other operators.
04-21-2015 02:47 PM - edited 04-21-2015 02:51 PM
Just autoindex over the array, unbundle the operator name, compare with the name, and stop the loop if a match is found (since your names seem to be randomly uppercase, you might want to do the comparison after converting to lower case). the index terminal will give you the array position.
Now change the Indexval property of the array indicator so "index minus 2" in the topmost element.
If you need more detailed help, please attach your VI with some typical data.
04-21-2015 02:50 PM
You need a FOR loop with the cluster array autoindexing. Inside of the loop, you unbundle the name and compare it to the desired name. If the names match, stop the loop (you will need to turn on the conditional terminal for the loop) and pass out the i. That will give you the index of the found person.
04-21-2015 02:53 PM
This is what I have also in my coding just before it is displayed. It is sorting by the number of completions, the I reverse the array to get highest to lowest.
04-21-2015 02:55 PM - edited 04-21-2015 02:56 PM
@NewerProductionDeveloper wrote:
This is what I have also in my coding just before it is displayed. It is sorting by the number of completions, the I reverse the array to get highest to lowest.
This seems unrelated, because there is no string element in the cluster.
Could you please attach the entire code instead of spoonfeeding us pictures of disconnected little bits of code?
04-21-2015 02:58 PM
This what you were talking about?
04-21-2015 03:00 PM - edited 04-21-2015 03:04 PM
@NewerProductionDeveloper wrote:
This what you were talking about?
I was talking about much more than that. 😄
What's up with the local variables? And why would you need to re-read the local variable of the string from scratch with each loop iteration? That makes no sense?
04-21-2015 03:04 PM
I had to remove the server connection data.
VI is attached...