The whole triple for loop can be replaces by these two lines:
binaryImage = IMG0 == 2;
IMG(binaryImage) = 10;
But of course you must have defined IMG0 first. If the image is unaltered then either (1) the binary image is false everywhere meaning IMG0 never equals 2 anywhere, or (2) IMG was already 10 in the locations where IMG0 equaled 2 (actually which can't be true because you normalized IMG).
By the way, iii is never defined either. So I'm pretty sure this is not the code you ran .
I suspect the problem is that you normalized IMG0 just like you did IMG and so it will never equal 2 and so IMG will never get changed to 10.