February 20th, 2014, 06: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?
February 20th, 2014, 11:57 AM
Re: Detecting Patterns in an array?
I'd remove every OTHER 0, then look for the 1's. Then, you'd have 0,1,0,1,1,1,0,1,0...
Click Here to Expand Forum to Full Width
This is a CodeGuru survey question.