plot a heatmap and then tried to save the figure with saveas function on workspace,

according to the guide of matlab website "https://kr.mathworks.com/help/matlab/ref/saveas.html?lang=en"

the code is

>> saveas(gcf,'abc.png') 

but, an error is occurred as follows,

 Error : matlab.graphics.internal.name (line 101)* 
 Cannot create output file '.\abc.png'*
 error : print (line 71)
 pj = matlab.graphics.internal.name( pj );
 error : saveas (line 181)
        print( h, name, ['-d' dev{i}] )

the contents of line101

error(message('MATLAB:print:CannotCreateOutputFile', pj.FileName));

답변 (1개)

madhan ravi
madhan ravi 2018년 10월 21일

0 개 추천

Try the full code:
x = [2 4 7 2 4 5 2 5 1 4];
bar(x);
saveas(gcf,'abc.png')
Remark : Create figure before saving

카테고리

도움말 센터File Exchange에서 Printing and Saving에 대해 자세히 알아보기

질문:

2018년 10월 21일

댓글:

2018년 10월 21일

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!

Translated by