index in safe-title
1 次查看(过去 30 天)
显示 更早的评论
I would like to define my file with the title, so that includes the according index. I tried:
saveas(gcf,'title_t{n}','jpeg')
saveas(gcf,'title', t{n},'jpeg')
Either wont work - is there a way?
Thanks in advance!
0 个评论
采纳的回答
Steven Lord
2021-5-6
Try:
str = "title_" + t{n}
saveas(gcf,str,'jpeg')
This will attempt to convert t{n} into a string and concatenate the string "title_" and that newly created string. I've defined it as a separate variable so you can see what it looks like. If this doesn't do what you want, show us the value of str that is displayed when you run this code and describe how it differs from how you want it to look.
更多回答(1 个)
KSSV
2021-5-6
saveas(gcf,[title_t{n},'jpeg'])
4 个评论
Walter Roberson
2021-5-6
What datatype is t{n} ? If it is numeric then
filename = sprintf('title_%g.jpg', t{n});
saveas(gcf, filename, 'jpeg')
另请参阅
类别
在 Help Center 和 File Exchange 中查找有关 String 的更多信息
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!