MATLAB: Do I get an error when using the command PRINT to export figures in *.pcx, *.pbm, *.pgm, or *.ppm format in MATLAB 6.0 (R12.0)

6.0MATLABpbmpcxpgmppmprintr12

Why do I get the following error when using the command PRINT to export figures in *.pcx, *.pbm, *.pgm, or *.ppm format in MATLAB 6.0 (R12.0)?
figure
plot(1:10)
print -dppm figure.ppm
??? Error using ==> print
Error using ==> D:\MATLABR12\toolbox\matlab\graphics\private\ghostscript
Ghostscript could not create 'figure.ppm'.
In some cases I have also received a segmentation violation (stack trace) or one of the following errors:
Problem using postscript
Ghostscript returned error
Undefined filename
Last OS error: No such file or directory,
Error in saveas.m.

Best Answer

This is a bug in MATLAB 6.0 (R12) that has been fixed in MATLAB 6.1 (R12.1).
If you are still using MATLAB 6.0, please print your figure using a different file format, such as .tif or .jpg.
To find the current working directory, type PWD or CD at the command prompt. For example:
pwd
cd