How do I save a figure as the title of the figure?
26 次查看(过去 30 天)
显示 更早的评论
I generate a figure with this code:
figure(1)
hold on
surf(xi, yi, Z)
title('WT 0HR', 'fontsize', 20)
....
set(gca, 'fontsize', 14, 'color','k')
set(gcf,'Color',[1,1,1])
Then I want to save the file as the title name as a tiff (eg. WT 0HR.tif)
thanks!
0 个评论
采纳的回答
fred ssemwogerere
2020-2-3
编辑:fred ssemwogerere
2020-2-3
This should do nicely for you.
handle=figure;
title_name='WT 0HR';
title(title_name, 'fontsize', 20);
surf(xi, yi, Z);
saveas(handle,title_name,'tiff');
0 个评论
更多回答(1 个)
Jeremy
2020-2-3
Assign your title to an object
th = title('WT 0HR', 'fontsize', 20);
And extract the title string using dot syntax, and use it in the save command
save([th.String,'.tif'])
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!