MATLAB: Contour Plot to Image.jpg

contour2dimage

Hello!
I need to know how to save or export a 2D Contour plot into an Image file (preferible with .jpeg extension).
I would like also to be able to specify the output location (the folder where the image will be saved), I have tried with this:
contourf(xx,yy,turbul_interp);
xlabel('AXIS X')
ylabel('AXIS Y')
hgsave('name_of_my_image');
But then it appears the following error message:
??? Error using ==> save
Unable to write file name_of_my_image.fig: permission denied.
Any idea about how to do it?. Thanks!

Best Answer

I would not use jpg format. I never create JPEG images. JPEG can/will degrade your image. Use PNG instead.
What does this report in the command window if you call it just before hgsave:
pwd
You probably can't save to that folder.