LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

delete column and replace it with column it with the column before it

Solved!
Go to solution

I have array look like the one below. As you see some of the column only has strings of 1 and some random string. I want to be able to delete those columns that have only 1 from the array and replace exact same column that the one before them has and count the # of repeat. All of the strings and their location will be generated so they won’t be exactly like this for every iteration in loop.

This is what I have:.

1

1

1

1

1

1

1

1

     kjhj

1

1

1

1

1

jhj

1

1

1

1

1

1

1

kjfhj

1

1

1

1

1

1

jshhgy

1

1

1

1

1

1

1

uhuh

1

1

1

1

1

1

1

jhsgdv

1

1

1

1

1

1

1

1

This is what I want:

1

1

1

1

1

1

1

1

kjhj

1

1

1

1

1

jhj[2]

jhj[1]

jhj[0]

1

1

1

1

1

kjfhj

1

1

1

1

1

1

jshhgy[1]

jshhgy[0]

1

1

1

1

1

1

uhuh

1

1

1

1

1

1

1

jhsgdv

1

1

1

1

1

1

1

1

 

0 Kudos
Message 1 of 12
(3,560 Views)

Try something like this.

 

 

 

(Of course you need to decide what should happen if the first column is all ones.)

 

Download All
0 Kudos
Message 2 of 12
(3,537 Views)

I am not very clear. On what basis is jhj[0] and jhj[1] getting generated?

0 Kudos
Message 3 of 12
(3,536 Views)

Delete

-----

The best solution is the one you find it by yourself
0 Kudos
Message 4 of 12
(3,527 Views)

Great job!!!!!!!Looks like it’s working but I still have to connect it to the rest of my labview and make sure it works.

My mistake but would you resend me the code with the iteration of the repeated item backward? Like the one below?

1

1

1

1

1

1

1

1

kjhj

1

1

1

1

1

jhj[0]

jhj[1]

jhj[2]

1

1

1

1

1

kjfhj

1

1

1

1

1

1

jshhgy[0]

jshhgy[1]

1

1

1

1

1

1

uhuh

1

1

1

1

1

1

1

jhsgdv

1

1

1

1

1

1

1

1

0 Kudos
Message 5 of 12
(3,507 Views)

I am so sorry i mean to say this

1

1

1

1

1

1

Kjhj[2]

Kjhj[1]

Kjhj[0]

1

1

1

1

1

jhj

1

1

1

1

1

1

Kjfhj[0]

Kjfhj[1]

1

1

1

1

1

1

jshhgy[0]

             1

1

1

1

1

1

1

uhuh

1

1

1

1

1

1

1

jhsgdv

1

1

1

1

1

1

1

1

0 Kudos
Message 6 of 12
(3,505 Views)

@razii wrote:

Great job!!!!!!!Looks like it’s working but I still have to connect it to the rest of my labview and make sure it works.

My mistake but would you resend me the code with the iteration of the repeated item backward? Like the one below?


That's actually a much easier problem! Give me a few minutes....

 

(In the simplest case, we ca just remove the two "reverse array" operations, but further simplications are possible (not shown)).

0 Kudos
Message 7 of 12
(3,484 Views)

Thank you but there is a part that you missed and that's probably my fault. You catch the fact that I wanted the increment to reverse (good job) but you did not pay attention that I was also asking you to increment the item after not the one before. If you compare my second chart I sent, you will see what I am talking about. Is there any way you can fix it and send it again? Thanks

0 Kudos
Message 8 of 12
(3,471 Views)

Well, you got all the templates right there. It is trivial to change, simply process the 2D array starting with the last column. 😉 Try it!

0 Kudos
Message 9 of 12
(3,466 Views)
Solution
Accepted by topic author razii

Here is my 2 minute rewrite based on the older code. Of course i could be simplified coding from scratch, but who cares... 😉

 

(One difference: It does not put the "jshhgy[0]" in the third column, because that seems like an exception.)

0 Kudos
Message 10 of 12
(3,462 Views)