0

I am working with satellite images on Matlab and am writing a code for calculating Net Radiation. The output contains the image in form of a matrix with NaN values. When I try to plot it using:

figure
imshow(X);

it assigns the NaN values the same color as 0. Is there any way I can assign those values to be a different color?

Also, I want to save my matrix as an image, but in a format that its values don't get changed ... possibly ASCII. Is there a tool for converting matrix to ASCII?

horchler
  • 18,384
  • 4
  • 37
  • 73
  • Can you post a link to an example of the image - satellite images come in a variety of range and types. In addition what do you mean save your matrix as an image without changing the values - what is the reason behind that and can't you just save a mat file? – eyalsoreq Oct 24 '15 at 15:59
  • The first part of your question has been answered at http://stackoverflow.com/questions/8481324/contrasting-color-for-nans-in-imagesc – Will Oct 24 '15 at 16:41

1 Answers1

0

If your X matrix, is a 2D matrix with values between 0 and 1 and NaN values, you can use the following command to change NaN values to for example 0.88.

X(isnan(X))=0.88;

but if the X matrix is 3D (for RGB) the answer is slightly different and this solution does not work.