ni.com is currently undergoing scheduled maintenance.

Some services may be unavailable at this time. Please contact us for help or try again later.

LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

consecutive elements in an array

Hi,
I have an array of 0's and 1's and I want to add the amount of consecutive 1's after 5 1's.
ie.....if I have the sequence 001111111001111110000001 it would count 2 from the first sequence 1 from the second list of consecutive 1's etc.
I don't know if I have explained this very well.
If anyone has any ideas??
Thanks in advance

0 Kudos
Message 1 of 6
(4,647 Views)
Yes, this should be very easy.
 
However, you need to decide what kind of output you want.
  1. A single integer, indicating the total number of excess 1s?
  2. An array, each element showing the size of each excess segment?
  3. A cluster of position and size of each excess segment?
  4. ...? 
0 Kudos
Message 2 of 6
(4,645 Views)
I just need a single integer for the output
Thanks for getting back to me.
0 Kudos
Message 3 of 6
(4,643 Views)
Try something like this (LabVIEW 8.0)
0 Kudos
Message 4 of 6
(4,637 Views)
Here's a picture of the code. Please modify for your exact purpose.
Please let me know if anything is not clear.

Message Edited by altenbach on 03-23-2007 09:43 AM

Message 5 of 6
(4,635 Views)
Thanks that works perfect!!Smiley Very Happy
0 Kudos
Message 6 of 6
(4,614 Views)