LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

Remove duplicates (development of find function)

Solved!
Go to solution

I am making a find function to mimic the usage of MATLAB's find function.

It's usage is [V I] = find(array<value, 4); where the find function finds values using the logic comparison to a value and returns the number of nearest values as specified. The indexes for the values are also returned. I am having an issue when duplicates exist. I would like the duplicates to be in order of how they appeared in the original array. but I need to separate out all duplicates, sort them then put them back with the rest. Any idea's on how to remove all duplicates?

 

Thanks,

0 Kudos
Message 1 of 3
(1,995 Views)
Solution
Accepted by topic author U-235

I found the solution. Duplicates for values less than zero need to be joined with the original index's, then sorted by the original index's, then sorted by the values, then reversed.

0 Kudos
Message 2 of 3
(1,964 Views)

Some unsolicited advice:

 

I'd replace the "If A then false else !B" with a Greater or equal to 0.

 

Or, if you're really worried about the performance impact of a third float compare, replace the "If A then false else !B" with "A nand B"...

0 Kudos
Message 3 of 3
(1,944 Views)