Automatic saving a figure as an image file in Matlab

試著忘記壹切 提交于 2019-12-05 19:39:40

You can save current figure into a file with PRINT of SAVEAS command generating the filename using loop counter:

saveas(sprintf('img%d.tif',num_picture))

or

 print('-dtiff','-r300',sprintf('img%d.tif',num_picture))

To answer your second question, have a look at avifile(). However, I've had better luck saving frames individually (compression quality issues if I recall correctly).

To save individual frames, you can use imwrite() or print() with a -dpng or similar option. From there, use sprintf() to generate a filename with your frame number in it, and you've got most of what you need. You'll need some sort of movie editor program (VideoMach, etc.) to turn those frames into a movie if you don't use Matlab's avifile(), however.

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!