Sorry, this is not more specific, but you can create a logical array with a TRUE value for each position that matches your condition, and FALSE for those who do not.
For something like [0, 1, 0, 0], when testing at 1 you will get an array [FALSE, TRUE, FALSE, FALSE]. In this case, you can make [0, 1, 0, 0] - (epsilon) [FALSE, TRUE, FALSE, FALSE] and leave the values 0 unaffected.
Example Boolean Matrix
source share