I have a question. How can I set null value into 0 on an image. Is there any way to do this in matlab. The image type is float-point, 32 bit, tif format. Null value (Nodata) of this image is -3.4028234663e+038. So the number is out of range of float-point. So I wanna replace those values with 0.
Share
Generally speaking, you can find all the elements to replace by:
where
Iis your image andxis the desired value to replace (in your case, that is the “null” value). However, a more practical syntax would be using a certain threshold value instead of the exact value:Now
idxholds the logical indices of the elements you want to zero out. After you obtainidx, just do:P.S
In practice, you can do achieve the same result without creating a temporary variable
idx, like so: