different file name in saving images
조회 수: 13 (최근 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
댓글 수: 6
Walter Roberson
2024년 11월 3일 16:37
for h = [10 20 30]
for w = [20 21 22]
filename = sprintf('Y_%03dmm_x_%03dmm.bmp',h,w);
%some calculation
imwrite(YourImage, filename);
end
end
추가 답변 (0개)
참고 항목
카테고리
Help Center 및 File Exchange에서 Image Processing Toolbox에 대해 자세히 알아보기
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!