You can use the function find() to find the indices of 1s in the array.
Here is an example:
>> a=[1 0 1 0 0 0 1 1 1 1 1 0 0 0]a = 1 0 1 0 0 0 1 1 1 1 1 0 0 0>> i=find(a==1)i = 1 3 7 8 9 10 11
If you want to find the first n indices, you can also mention that as a parameter of the function.
>> i=find(a==1, 2)i = 1 3