Suppose an index vector in binary like below
Input
1 1 0 0 1 0 1
1 2 3 4 5 6 7
Intended output
1 2 5 7
which denotes n
th number to be chosen. So I want to change 1 1 0 0 1 0 1
to 1 2 5 7
, is there some easy way for this?
The solution is using the function find(indicesBinary)