matlab可以快速保存所有图片吗
时间: 2023-07-22 13:28:23 浏览: 156
是的,Matlab提供了多种方法来快速保存所有图片。以下是一些示例代码:
1. 保存当前Figure窗口中的所有图片为PNG格式:
```
h = get(0, 'children');
for i = 1:length(h)
saveas(h(i), ['figure' num2str(i) '.png']);
end
```
2. 保存所有打开的Figure窗口中的所有图片为PDF格式:
```
h = get(0, 'children');
for i = 1:length(h)
if strcmp(get(h(i), 'type'), 'figure')
print(h(i), '-dpdf', ['figure' num2str(i) '.pdf']);
end
end
```
3. 保存指定路径下所有Figure窗口中的所有图片为JPEG格式:
```
folder = 'path/to/folder';
h = get(0, 'children');
for i = 1:length(h)
if strcmp(get(h(i), 'type'), 'figure')
saveas(h(i), fullfile(folder, ['figure' num2str(i) '.jpg']), 'jpg');
end
end
```
这些示例代码只是展示了Matlab中保存所有图片的一些方法,你可以根据自己的需要进行修改和扩展。
阅读全文
相关推荐


















