问题描述
我正在Matlab中创建49个图形,它们都是一个接一个地自动创建的.我希望它们也自动保存为.tif
或.jpg
图像,其名称与它们的图形编号相对应.我可以做吗?如果可以,怎么办?
I'm creating 49 figures in Matlab, they are all created automatically one after the other. I want them to also automatically be saved as .tif
or .jpg
images with names corresponding to their figure number.Can I do it? And if so,how?
用于创建图形的代码是:
the code for the creation of the figures is:
for num_picture=0:48
...
figure (num_picture+1)
imshow (screen_im)
end
...
部分是screen_im
的所有计算结果所在的地方.
The ...
part is where all the calculations of screen_im
are.
我想要这些图像以便从它们中创建电影,如果有一种方法可以通过Matlab自动创建电影,那也很好,实际上会更好.
I want those images in order to create a movie from them, If there is a way where I can create the movie automatically form Matlab, it would be good also, actually it will be better.
推荐答案
您可以使用打印" rel ="noreferrer"> SAVEAS 命令使用循环计数器生成文件名:
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))
或
print('-dtiff','-r300',sprintf('img%d.tif',num_picture))
这篇关于在Matlab中自动将图形保存为图像文件的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!