To save a figure in MATLAB as a jpg file, you can use the imwrite
function. The steps to do this are:
saveas
function to save the figure as a png file.imread
function.imwrite
function to save the png file as a jpg file.Here is the code to do this:
main.m295 chars17 lines
The above code will create a figure, plot some data, save the figure as a png file, then read the png file and save it as a jpg file. You can change the file names to whatever you like, and adjust the imwrite
options as necessary.
gistlibby LogSnag