LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

bit complicated question

Solved!
Go to solution

Hello,

 

so I have got coordinates, for example A(4,5); B(3,2); C(1,9), D(4,3). I need to order them into a rising order after the last numerical character so that they stay together. I mean: B(3,2), D(4,3), A(4,5), C(1,9).

Any idea?

Thank you for every answers.

0 Kudos
Message 1 of 7
(2,488 Views)
Are you trying to sort your coordinates by the second field? Try using the Array 1D Sort function. This will sort an array of clusters by the first elements of the cluster. Therefore, if you store your data in clusters using the y axis coordinate as the first element, then your x axis coordinate as the second element and build an array of these, a sort operation will sort by the y-axis coordinate for you.
Thoric (CLA, CLED, CTD and LabVIEW Champion)


Message 2 of 7
(2,482 Views)

Hello Thoric,

 

The idea is really good it would also work, but I have to give the letters to the coordinates, and with letters (as string) I can`t make sortable arrays. Do you have an idea how to add the letters to the coordinates and then to sort them together by one of the fields?

I hope i don`t disturb you so much,

 

Thomas

0 Kudos
Message 3 of 7
(2,454 Views)

Thomas,

 

Make a cluster of three elements: [ y, x, Letter], where y and x are the numeric coordinates and Letter is a string control with the names of the points.  Put these clusters into an array and use the array sort.  By putting y first in the cluster as Thoric said, you get the sort on that component.

 

Lynn 

Message 4 of 7
(2,445 Views)
Solution
Accepted by topic author raditomi

johnsold wrote:

Thomas,

 

Make a cluster of three elements: [ y, x, Letter], where y and x are the numeric coordinates and Letter is a string control with the names of the points.  Put these clusters into an array and use the array sort.  By putting y first in the cluster as Thoric said, you get the sort on that component.

 

Lynn 


 

.... and in the event of two Y values being the same, the tie-breaker is the second element in the cluster (X).

 

Ben

Retired Senior Automation Systems Architect with Data Science Automation LabVIEW Champion Knight of NI and Prepper LinkedIn Profile YouTube Channel
Message 5 of 7
(2,442 Views)

Thanks, Ben.  I forgot about that when I answered, although the issue of multiplicity did occur to me when I first read the question.

 

Lynn 

Message 6 of 7
(2,439 Views)

It works 🙂

I just wanted to thank you guys for helping me.

 

Have a nice day,

Thomas

0 Kudos
Message 7 of 7
(2,420 Views)