How to inverse a Boolean vector?

I have an Index that is generated as below:

Flag = ["A", "B", "C"]
Ind = cmp.(Flag, "A")

The results:

3-element Vector{Int64}:
 0
 1
 1

However, what I need is to find where the "A"s are, so I want the inverse values of Ind. I tried both !Ind and .!Ind, unfortunately, neither of them works. There must be a way to inverse these Boolean values in Julia, am I right?

Note that what was produced by cmp is not a boolean vector.

You may use findall():

Flag = ["A", "B", "C", "A"]
findall(x-> x=="A", Flag)

Or to get a BitVector: "A" .== Flag

1 Like