LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

Delete duplicate entries

It is very simple if you want the output array sorted (top code).
 
It can become a bit more complex if you want to retain the original order of elements (bottom code).
 
basically, instead of searching for each element (a slow operation for huge arrays), you should work on a sorted array, which forces identical elements to be adjacent. Then just keep only elements that are different to the previous. Note that the input array is re-used and expensive building of arrays is avoided. The output is trimmed to the final size at the end.
 
If you want to retain element order, just drag the original sort key along for the ride, then re-sort by key at the end. Rest of code is similar.
 
It would be intersting to compare performance for large arrays. (Example code is in LabVIEW 8.0. Not fully tested, so there could be bugs ;))
 
 
 

 

Message Edited by altenbach on 05-01-2007 08:46 AM

Download All
Message 21 of 23
(793 Views)

can you name the array function which is used after search 1D array function in case structure

0 Kudos
Message 22 of 23
(369 Views)

@bruslero wrote:

can you name the array function which is used after search 1D array function in case structure


You need to be more clear! This a long thread with several different pictures containing "search array". Some use "built array", some use "delete from array" (both inefficient) and some use "replace array subset". Hope this helps.

 

Also note that this is a very (very!) old thread. LabVIEW 2019 has a native function "remove duplicates from 1D array" which does everything using sets and implemented as a vim.

 

altenbach_0-1587230022320.png

 

 

 

0 Kudos
Message 23 of 23
(360 Views)