Search code examples
imagematlabplotcontourf

How to save contourf figure to image (.jpg) using matlab?


I want to save figure of contourf to image (.jpg). i tried using saveas(gcf, output, 'jpg') and the result is blank .jpg file. Can you help me so the plot contourf can saving in my computer?

contourf(L, jml_level)
colormap autumn
figure

This is result of contourf

Thankyou.


Solution

  • You can use figure handle to indicate which figure to save

    fig1 = figure;
    contourf(L, jml_level)
    colormap autumn
    saveas(fig1,'cont.png')