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 Idea Exchange

cancel
Showing results for 
Search instead for 
Did you mean: 
WG-

LabVIEW sort, ability to edit comparison.

I assume that the LabVIEW sort algorithm is a comparison based sorting algorithm (and my guess is that they use a form of mergesort & insertionsort, and maybe better, timsort). Anyway, for arrays of integers, string this works perfectly. For clusters and classes the implementation does not work that smooth since the sorting algorithm will always sort on the first parameter in the cluster, respectivily class. For this reason it is in my opinion that the sort VI should have some kind of ability to edit the comparison on how the sort VI actually sorts. In many languages you have the ability to do this but not in LabVIEW. This would be very usefull for when sorting classes and clusters. 

 

A example of how this should be implemented is as followed. When the sort VI has a non-standard LabVIEW datatype as input, one should be able to add a reference to a VI (or add by a menu), with 2 inputs and 1 output. In this VI the user needs to define the rules which apply to the datatype of the input. In the end the VI will output a boolean, telling if input 1 is greater (depending on which sorting algorithm LabVIEW uses) then input 2.

6 Comments
Mr.Mike
NI Employee (retired)

Better array sorting has been suggested multiple times before.  Please remember to search before submitting an idea.

-- Mike
tst
Knight of NI Knight of NI
Knight of NI

Mike, the difference is that this idea offers a concrete suggestion for providing a general comparison mechanism (see the comments in your "been" link).


___________________
Try to take over the world!
WG-
Member
Member

The problem is is that now the sorting is always on 1 element. But maybe you don't want to sort on multiple elements or for different clauses. You can't implement that now but you can if you were able to define your own comparision. You can see this idea as the suggestion that operator overloading for the comparision, for sorting, should be made possible.

AristosQueue (NI)
NI Employee (retired)

Tst: I think you missed the point... every individual word of Mike's links goes to a different idea on this topic.  But, Mike, you missed one:

http://forums.ni.com/t5/LabVIEW-Idea-Exchange/Allow-overriding-of-Equality-and-Comparison-operators-...

 

This is definitely a duplicate.

tst
Knight of NI Knight of NI
Knight of NI

Tst: I think you missed the point... every individual word of Mike's links goes to a different idea on this topic. 


 

No, I got that. I was talking specifically about your comment in Mike's first link.

 

 


But, Mike, you missed one:

http://forums.ni.com/t5/LabVIEW-Idea-Exchange/Allow-overriding-of-Equality-and-Comparison-operators-...

 

This is definitely a duplicate.


I don't see how this is a duplicate of that. That idea talks about overriding the primitive for LVOOP wires and this idea follows the suggestion you made in the comment I was talking about of letting us provide a comparison VI as part of the existing sort algorithm.
Again, I don't think any of the other ideas use that concept.

___________________
Try to take over the world!