如何从命令行在MATLAB中保存图形? [英] How to save a figure in MATLAB from the command line?

查看:77
本文介绍了如何从命令行在MATLAB中保存图形?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

MATLAB中是否有一条命令可以将图形保存在 FIG 或<是href ="http://en.wikipedia.org/wiki/JPEG"> JPEG 还是自动两种格式?

Is there a command in MATLAB which allows saving a figure in FIG or JPEG or both formats automatically?

推荐答案

使用 saveas :

h=figure;
plot(x,y,'-bs','Linewidth',1.4,'Markersize',10);
% ...
saveas(h,name,'fig')
saveas(h,name,'jpg')

通过这种方式,图形被绘制,并自动保存到".jpg"和".fig".您无需等待绘图出现,然后在菜单中单击另存为".如果需要绘制/保存大量图形,该走的路.

This way, the figure is plotted, and automatically saved to '.jpg' and '.fig'. You don't need to wait for the plot to appear and click 'save as' in the menu. Way to go if you need to plot/save a lot of figures.

如果您真的不想让该图出现(无论如何都必须加载该图,无法避免这种情况,否则也没有任何可保存的内容),可以将其隐藏:

If you really do not want to let the plot appear (it has to be loaded anyway, can't avoid that, else there is also nothing to save), you can hide it:

h=figure('visible','off')

这篇关于如何从命令行在MATLAB中保存图形?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆