A is an array of [441000,1]. The values contained in this array are in the order:
a = 0 0 0 0 1 1 1 1 0 0 0 0 1 1 1 1 1 0 0 0
I have to find the difference between every starting 1 (i.e 1 after ever 0) and till the next xth position 1. (the position of first 1 – the position of xth 1 after the first series of 1).
So, first difference would be 101-1200 and then 1090-2202, 2200-3200 and so on. Kind of creating an overlap for every cutout.
In the data sample, there are approximately 1300 zeros after 100 ones. So I have to cut out the first one till the next 4th or 5th one and calculate the difference.
It feels like a simple code, but I am totally lost atm.
Thanks for your help!
Best Answer