MATLAB Answers

Tomas
0

How can I export figure as png?

Tomas
さんによって質問されました 2014 年 10 月 7 日
最新アクティビティ Michael Haderlein さんによって 編集されました 2014 年 10 月 7 日
I have the script which creates 3D figure. The only way to save it is
hgsave(graph, [input, output, '\', string{i + 8}, '.png'],'-v7.3');
I tried different ways to save it as png and all failed. It stores only axis.
print(graph,'-dpng',[input,output,'\',string{i +8},'.png']);
saveas(graph, [input, output, '\', string{i + 8}], 'png');
hgexport(graph, [input, output, '\', string{i + 8}, '.png'], hgexport('factorystyle'), 'Format', 'png');

  0 件のコメント

サインイン to comment.

4 件の回答


Julia
Julia 님의 답변 7 Oct 2014
Julia 님이 편집함. 7 Oct 2014

Hi,
I create a figure and save it with the follwoing command:
saveas(gcf,'picture.png')
Perhaps
saveas(gcf, [input, output, '\', string{i + 8}], 'png');
works.

  1 件のコメント

Tomas
on 7 Oct 2014
All I tried didn't work. Even if I select Save as from figure menu it still save only the axis.

サインイン to comment.


Wouter
Wouter 님의 답변 7 Oct 2014

Best option is to use the export_fig function from the file exchange. It actually works out of the box and intuitively (not like the annoying builtin saveas function)

  0 件のコメント

サインイン to comment.


Answer by Michael Haderlein on 7 Oct 2014
Edited by Michael Haderlein on 7 Oct 2014

Did you try another renderer? I can't really explain a lot about it, but I think I once had a similar problem (though everything was black in my case) and choosing another renderer has fixed the case.
In case neither this nor the other suggestions work: I feel a bit embarrassed to mention it here, but once I was desperate enough to simply make a screenshot and save this. In case none of the solutions here works, this will for sure.

  0 件のコメント

サインイン to comment.



Translated by