LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

Deleting repeated elements in 2D array

Solved!
Go to solution

Hi all,

 

Would be grateful if there is someone can help me to delete the repeated elements in the 2D array as in the attached thread. Thanks in advance

0 Kudos
Message 1 of 11
(3,660 Views)

@Al-rawachy wrote:

Hi all,

 

Would be grateful if there is someone can help me to delete the repeated elements in the 2D array as in the attached thread. Thanks in advance


Sorry, your question is not specific enough to give an answer. 

What do you mean by "attached thread?" I looked at the attached VI and it has only 1D arrays in it, not 2D.

What do you mean by "repeated elements?" Is that any element, or matching rows, or matching columns? If you mean any element, then what do you mean by delete? Setting it to default for that datatype, or NaN? 

Message 2 of 11
(3,652 Views)

Try this.  The first element in any array cannot be duplicated by default.

LV2017 Remove_Array_Duplicates.png

Help the Community (and future reviewers) by marking posts as follows:
If it helped - KUDOS
If it answers the issue - SOLUTION
Message 3 of 11
(3,627 Views)
  • You have a 1D array, not a 2D array.
  • All values seem to be integers, so why do you use an orange datatype? With DBL, equality is difficult.
  • "delete from array" is dangerous unless you delete the last element, because all indices of existing elements change. It should never be used repeatedly in a loop.
  • Have you heard of the conditional output tunnel? It would significanlty simplify your code.
  • (I would probably use a variant attribute base solution.)
Message 4 of 11
(3,607 Views)
Solution
Accepted by topic author Al-rawachy

As said before, if you have integers, change the data type of your input 1D array to I32.

If you use LabVIEW 2017, there is a VIM to do this for you in one step. If you have earlier version of LV, you can download the OpenG Arrays toolkit from VIPM, and use that:

 

removedup.png

Message 5 of 11
(3,590 Views)

Thank you guys for your help. it is really helpful

0 Kudos
Message 6 of 11
(3,577 Views)

Hi Blokk,

 

+1 kudos from me for your really helpful post!

 

Could you maybe elaborate a bit more on where you found the VIM? I have LabVIEW 2017 Professional installed but could not find this VI. I only found the openG version on my machine.

 

Thank you a lot!


Ingo – LabVIEW 2013, 2014, 2015, 2016, 2017, 2018, NXG 2.0, 2.1, 3.0
CLADMSD
0 Kudos
Message 7 of 11
(3,539 Views)

@ikaiser wrote:

Hi Blokk,

 

+1 kudos from me for your really helpful post!

 

Could you maybe elaborate a bit more on where you found the VIM? I have LabVIEW 2017 Professional installed but could not find this VI. I only found the openG version on my machine.

 

Thank you a lot!


Hmm, I might have used accidentally my LV2018 beta at home when posting to this thread. I do not have access right now to LV2018, but I guess this is the case. Anyway, LV2018 is now officially released and accessible, so I do not violate the NDA 🙂 

Message 8 of 11
(3,533 Views)

@ikaiser wrote:

Hi Blokk,

 

+1 kudos from me for your really helpful post!

 

Could you maybe elaborate a bit more on where you found the VIM? I have LabVIEW 2017 Professional installed but could not find this VI. I only found the openG version on my machine.

 

Thank you a lot!


Just for the reference, the above mentioned vim is not an NI one, neither exists in LV2018. I totally forgot that some time before, I installed a package from LAVA, so that vim is from Hooovahh:

https://lavag.org/files/file/296-hooovahh-array-vims/

Message 9 of 11
(3,476 Views)

Remove Duplicates.png

You can also use Variant attributes with the side effect of the output array also being sorted.

/Y

G# - Award winning reference based OOP for LV, for free! - Qestit VIPM GitHub

Qestit Systems
Certified-LabVIEW-Developer
0 Kudos
Message 10 of 11
(3,467 Views)