LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

Replace 1's with 0's if they are less than 900

Solved!
Go to solution

Labview_Problem.PNG

I'm struggling with the last part of my solution. I have a 1D Array with 1's or 0's. As the title suggests I'm looking for multiple 1-sequences and if they are less than 900 1's in a row I would like to replace them with zeros.

 

What I already achieved is finding the start and end of each sequence with 1's and their index and forming a pair of them. So I'm already able to work with the correct indexes. I posted a picture of my last and final step where I want to replace the 1's with 0's. I go in with the first pair, go in another for loop which runs (end of 1's - start of 1's) times. And start to iterate from the start index these N times. But somehow this part does not work and I do not know why. In my notes it makes sense, but I have made an error somewhere. I would be really grateful for some good tips.

0 Kudos
Message 1 of 6
(2,766 Views)
Solution
Accepted by Shurican

Hi, Shurican!

You should use shift registers instead of tunnels for the array, passing your inner For loop. In your case, you see only the result of inner's loop last iteration.

Message 2 of 6
(2,737 Views)

Hi, Sam_Rudneff

 

Thanks for your Input I read about it and implemented the shift registers in my code. I was not aware that I need a shift register, but it works perfectly fine now!

As I thought I had to rise the number N by 1.

 

So in my old code it basically did what I meant to but only saved the last iteration of my inner loop (only one value was saved)? 

0 Kudos
Message 3 of 6
(2,716 Views)

So in my old code it basically did what I meant to but only saved the last iteration of my inner loop (only one value was saved)? 


Exactly. )

0 Kudos
Message 4 of 6
(2,711 Views)

@Shurican wrote:

So in my old code it basically did what I meant to but only saved the last iteration of my inner loop (only one value was saved)? 


That is correct.  Specifically, the last iteration of your inner loop using the values from the last iteration of your outer loop.  Tunnels default to only outputting the last value.  Shift Registers are used to keep values from iteration to iteration.


GCentral
There are only two ways to tell somebody thanks: Kudos and Marked Solutions
Unofficial Forum Rules and Guidelines
"Not that we are sufficient in ourselves to claim anything as coming from us, but our sufficiency is from God" - 2 Corinthians 3:5
Message 5 of 6
(2,710 Views)

Thanks for the fast replies and help!

 

It was rather a newbie question, but I really understood how I have to use these shift registers in my future projects 🙂

0 Kudos
Message 6 of 6
(2,699 Views)