The command
SAVEAS(H,'FILENAME','FORMAT')
saves the figure specified by handle H to file name FILENAME. When FILENAME does not contain an extension (it has no periods in it), an extension corresponding to FORMAT is appended to the file name.
If FILENAME contains periods in it, MATLAB interprets this as an extension. The FORMAT option overrides whatever extension is specified by FILENAME, but the correct extension is not appended to FILENAME. If desired, the correct file extension must be explicitly defined in the filename.
For example, see the code below:
plot(1:10)
saveas(gcf, 'test1', 'tif')
saveas(gcf, 'test2.123', 'tif')
saveas(gcf, 'test3.123.tif', 'tif')
Best Answer