different file name in saving images
5 次查看(过去 30 天)
显示 更早的评论
In the below script, based on iteration numbers in for loop, I need to change Y_10, Y_20,Y_30,Y_40.....Y_100
Is there a way to achive this instead of renaming everytime ??
saveas(gcf, sprintf('Y_10mm'), 'bmp')
savefig(gcf, sprintf('Y_10mm')
0 个评论
采纳的回答
DGM
2022-4-27
编辑:DGM
2022-4-27
In whatever loop you're using, create the filename something like this:
k = 10 % whatever number you need
sprintf('Y_%03dmm.bmp',k)
Unless you have a need to avoid it, zero-pad your numbers so that your files sort correctly and are easier to read back in corresponding order
4 个评论
DGM
2022-4-27
You can add more something like so.
h = 10; % for example
w = 20;
sprintf('Y_%03dmm_x_%03dmm.bmp',h,w)
更多回答(0 个)
另请参阅
类别
在 Help Center 和 File Exchange 中查找有关 Startup and Shutdown 的更多信息
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!