How do I create a JPEG file and/or a plot without opening a figure window? I want to directly send a plot to a file. In other words, I want to create a JPEG file using the PRINT command, but I do not want a figure window to open.
John Williams answered .
2025-11-20
h = figure('visible', 'off')
surf(peaks)
print -djpeg test
close(h)
PLEASE NOTE: This method is currently not available for all image formats. In particular, it does not work for bitmaps, and may not work for other formats as well.