LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

Count number of zero terms between non zero terms

Solved!
Go to solution

Hi.  I have an array of data consisting of zero and nonzero terms (Example:  {1 2 56 2 3 0 0 0 0 0 2 3 5 2 3 5 2 0 0 0 0 32 43 })  I need to count the number of zeros in each string of zeros and plot that number against the first non zero term following the string of zeros (NOTE:  string is used here as a description of a series of zeros, not a string variable).  So the resulting plot coordinates from my example would be (5,2) and (4,32).

 

I am clear on how to do the plotting, but I am unable to store only each final tally of consecutive zeros without having some unecessary data in my plot.

 

Thank you in advance to everyone who has advice!

 

-Mike

0 Kudos
Message 1 of 5
(3,556 Views)
There are several ways to do this, but your description of the problem seems to imply that you're currently already doing something to find these consecutive zeros, but you get "unnecessary data". What is this unnecessary data that you're getting? Can you post your code so we can comment on it?
0 Kudos
Message 2 of 5
(3,553 Views)
Solution
Accepted by topic author Pushrod

Doing anything like this?

 

EDIT: Minor correction due to extra Decrement function.

Message Edited by smercurio_fc on 02-05-2009 10:34 AM
Message 3 of 5
(3,545 Views)

Nice work!  That is exactly what I was looking for; thank you for your assistance.

 

-Mike

0 Kudos
Message 4 of 5
(3,518 Views)
(a small simplification: you can eliminate the array size and decrement at the end by simply wiring the iteration terminal output to the lower terminal of the reshape node. 🙂 It will always contain the "array size-1" of any autoindexing outputs when the loop finishes. :))
Message 5 of 5
(3,500 Views)