Hello everyone,
I have one array e.g.
a= [1 1 1 1 0 0 1 1 1 0 0 0 0 1 0 0 0 0 1 0
0 1 1 1 1 1 1 0 0 1 1 0 0 0 0 1 0 1 0 0
1 1 1 0 0 0 0 1 0 1 0 0 1 0 1 0 1 0 0 0
0 0 0 1 0 0 1 0 1 0 1 1 1 1 1 1 0 0 0 1];
for this example I want to make groups of 4 so for this case we will get 5 groups for one row.
so, for every group I want to check the index of '1s' from this original array a.
for example,
for 2nd group i.e. [0 0 1 1] and I want to check that index where there is one in this case I want the index should be 7 and 8
I used find(a(i,j)==1) in two for loops but this line always giving '1' index
Can you please help me to solve this problem??
Best Answer