I am trying to do conditional statement in ENVI to calculate multiband image:

result = (b1)^2 - (b2)^2
if (b1 eq 0) or (b2 eq 0)
result * 0
result * (result gt 0.0)

Is there a way to combine the statements in Band Math? Or I have to write in IDL?

1 Answer 1


A bit late, but this expression would work using ENVI Band Math:

(b1^2 - b2^2) * ((b1 NE 0) AND (b2 NE 0))


Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.