From Friday, April 19th (11:00 PM CDT) through Saturday, April 20th (2:00 PM CDT), 2024, 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: 

Index array of a cluster

Solved!
Go to solution

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?

0 Kudos
Message 1 of 23
(7,607 Views)

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!

0 Kudos
Message 2 of 23
(7,603 Views)

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.

0 Kudos
Message 3 of 23
(7,594 Views)

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.

0 Kudos
Message 4 of 23
(7,572 Views)

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.


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 5 of 23
(7,568 Views)

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.

0 Kudos
Message 6 of 23
(7,560 Views)

@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?

0 Kudos
Message 7 of 23
(7,555 Views)

This what you were talking about?

0 Kudos
Message 8 of 23
(7,551 Views)

@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?

0 Kudos
Message 9 of 23
(7,545 Views)

I had to remove the server connection data.

 

VI is attached...

0 Kudos
Message 10 of 23
(7,539 Views)