Error in saveas, can't save current figure
Show older comments
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));
Answers (1)
madhan ravi
on 21 Oct 2018
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
1 Comment
madhan ravi
on 21 Oct 2018
see attached .png file
Categories
Find more on Printing and Saving in Help Center and File Exchange
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!