You can use find to get the index when an expression is true, and "==" to get that logical array. Something like this should work:
Note, however, that this will only do an absolute comparison. If you wanted to find with some kind of tolerance, you could do:
idx = find(abs(z+2) < 0.001);
Also note that if you are then going to use this index for indexing into the array, it's usually more efficient to just use the logical array to index:
Hope this helps!