I have MATLAB matrices that contain NaN values. These are raster data that contain NaN values (the NaN values are an ocean mask). I use geotiffwrite to write them to .tif files, but when I load the .tif files into ArcMap to create a map, it seems that the NaN values have been replaced with -Inf and +Inf (which ArcMap displays as something like -1.38e-38 and 1.38e38). Arc has tools for setting NoData, but they are in the Spatial Analyst toolbox that I do not have authorized.
In general, it is not clear from the documentation how geotiffwrite handles NaN values. There should be a tag in the GeoKeyDirectory to set the value of NoData, but there doesn't appear to be one.
How can I set the NoData value in the R spatial referencing object (or otherwise) so that when I export a .tif file from MATLAB using geotiffwrite, any and all other spatial software will recognize the NoData value (e.g. R, Arc, QGis, GRass, etc).