save images inside for loop
显示 更早的评论
In the below for loop, i runs from 1 3 5 7 ....100. But I would like to save images Y1.bmp, Y2.bmp, Y3. bmp .... instead of Y1.bmp, Y3.bmp, Y5. bmp. Is there any way to implement this in the below for loop
for i = 1:2:100
%% operation %%
saveas(gcf,sprintf('Y_%d.bmp',i))
end
采纳的回答
更多回答(1 个)
Walter Roberson
2024-10-22
for i = 1:2:100
%% operation %%
saveas(gcf,sprintf('Y_%d.bmp',(i+1)/2))
end
类别
在 帮助中心 和 File Exchange 中查找有关 Images 的更多信息
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!