Why do I receive different results when I use the SAVEAS function and File -> Save As within the MATLAB Figure window in MATLAB 7.0 (R14)?
In MATLAB 6.5.1 (R13SP1), using the SAVEAS function to save a picture to a file produced the same results as using File>Save As from the figure menu bar. In MATLAB 7 (R14), the two commands produce different results. Specifically, if I have set my axes to a color, the SAVEAS function produces a white axes and File>Save As produces the color axes.
If I switch the figure 'InvertHardCopy' property to 'Off', the SAVEAS function creates a figure containing both the figure and axes color. However, File -> Save As does not reproduce the figure color. Below is some example code to demonstrate the occurrence.
% create plot
plot(1:10)% set axes color to dark blue
set(gca, 'Color', [0 0 .3])% save to file
saveas(gcf, 'commandLineSaveAs.jpg')pause % during pause, use File -> Save As
% and save to file (e.g.fileSaveAs.jpg)
% Then hit key to resume
% set InvertHardCopy to 'off'
set(gcf, 'InvertHardCopy', 'off')% save to filesaveas(gcf, 'commandLineSaveAsInvert.jpg')% now use File -> Save As and
% save to file (e.g. fileSaveAsInvert.jpg)
Best Answer