February 20th, 2014, 07:09 AM
Detecting Patterns in an array?
Hi, whilst im faily new to c# development I am a fulltime PHP developer but I suppose neither of which matter really for this question.
What I have is an array with a size of 40 and what im doing is reading data from a source (irrelivent) every second and detecting "something" which I then set specific index's in the array from 0 to 1.
So majority of the time the array will be zeros:
But I then might have 0,0,0,1,1,1,0,0,0,1,1,1,1,1,0,0...00 So as you can see I have 3 x 1's and then 5 x 1's and what I want to do is somehow detect the 1's and there positions but only if there are 2 or more 1's together? So in the above example i would detect that there was 3 x 1's and 5 x 1's and there positions?
Is there an easy way of doing this?
Click Here to Expand Forum to Full Width
This is a Codeguru.com survey!