savefigures with filenames from a cell array
조회 수: 3 (최근 30일)
이전 댓글 표시
I intend to save the figures with the names that being defined in the cell array
for e.g. as shown in the below code, the final name should be A_X_3_Y_5.bmp
vars = {'A','B','C','D','E','F'};
f=3;
g=5;
saveas(gcf, sprintf('(vars{1})_X_%3d_Y_%3d.bmp',f,g))
댓글 수: 0
채택된 답변
Stephen23
2022년 12월 22일
편집: Stephen23
2022년 12월 22일
You are already calling SPRINTF() to generate the filename, so just provide it with the text input too:
vars = {'A','B','C','D','E','F'};
f = 3;
g = 5;
fnm = sprintf('%s_X_%d_Y_%d.bmp',vars{1},f,g)
saveas(gcf,fnm)
Read the SPRINTF documentation to know more:
추가 답변 (0개)
참고 항목
카테고리
Help Center 및 File Exchange에서 Printing and Saving에 대해 자세히 알아보기
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!