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

cancel
Showing results for 
Search instead for 
Did you mean: 

how to remove duplicate element in an 2D array

Solved!
Go to solution

Hi ,

I am new to labview. I have a 2d array,in that I have to remove the duplicate elements and also wanted to count  duplicate elements.I have included the example for it.Screenshot (82).png

0 Kudos
Message 1 of 7
(2,294 Views)

Hi sanjay,

 


@sanjay92 wrote:

I have a 2d array,in that I have to remove the duplicate elements and also wanted to count  duplicate elements.I have included the example for it.


You have a 2D array control, but you only show the first column:

  • What data is in the other columns?
  • How do you define "duplicate" elements: compare only the first column or the whole row?
  • When the other columns aren't of interest then why don't you use an 1D array right from the beginning?
  • Do you use a string array or numeric data?

 

What did you learn from your other thread?

What have you tried to solve that homework on your own?

Why don't you attach an example VI containing reasonable default data in your array control? (You should have learned to attach code from your other thread!)

Best regards,
GerdW


using LV2016/2019/2021 on Win10/11+cRIO, TestStand2016/2019
0 Kudos
Message 2 of 7
(2,284 Views)

Hi ,

Here I have attached my code. In that code it will remove all the repeated elements but what I need is like only the continuous repeated element should be removed and also I have to count the repeated elements. And I am getting the input from the textfile.

0 Kudos
Message 3 of 7
(2,258 Views)
Solution
Accepted by topic author sanjay92

Hi sanjay,

 


@sanjay92 wrote:

Here I have attached my code. In that code it will remove all the repeated elements


In this VI of yours there is nothing done at all because the code is broken…

 

Just a suggestion:

This code mostly does what you need, but not completely. Improve it on your own!

 


@sanjay92 wrote:

I am getting the input from the textfile.


It doesn't matter where the data comes from: this function should use a 1D array control as input!

What's the point of using a 2D array input with only the first column used?

Best regards,
GerdW


using LV2016/2019/2021 on Win10/11+cRIO, TestStand2016/2019
0 Kudos
Message 4 of 7
(2,234 Views)

Can you please sent the image for true case also.It will be helpful for me to understand.

0 Kudos
Message 5 of 7
(2,221 Views)
Solution
Accepted by topic author sanjay92

@sanjay92 wrote:

Can you please sent the image for true case also.It will be helpful for me to understand.


 

The true case should be quite obvious once you understand the problem. (Hint: two items are just wired across unchanged)

 

Of course one does not really need a case structure or 2D arrays. Here's my suggestion. See if you can recreate it from the picture, a good exercise! 😉

 

altenbach_0-1624636585109.png

 

 

 

 

Message 6 of 7
(2,191 Views)

Thankyou for your help.And now I can able to understand the data flow.

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