my input array is 1 1 0 0 0 1 1 1 1 1 0 1 0 0 0 1 1 1 1 1 1 1 1 0 0 1 1 1 0
i want output as - (indices where ones in array)
start index end index
1 2
6 10
12 12
16 23
26 28
Also i want to know how to convert matrix into one dimensional array in matlab