MATLAB: How to save an imagesc file as a grayscale tif

imagescimwrite

In this .mat file is a uint16 1040×1392 image. I can open a figure of the image using
imagesc(img); colormap(gray);
but I have no idea how to save the image as a tif file. I tried using
imwrite(img, 'myImage.tif');
but all I get is a completely black image.

Best Answer

imwrite( mat2gray(img), 'myImage.tif')