I want to include a variable in my figure title when I save to a directory.

6 ビュー (過去 30 日間)
Sandra Cole
Sandra Cole 2022 年 4 月 13 日
コメント済み: Sandra Cole 2022 年 4 月 13 日
This works:
saveas(figure(1),[pwd '/PRCC plots for submission 2/Final E monoton 2029.fig']);
I want to put this variable into the figure title:
TIMEend=2029;
Is this possible?
Thanks

採用された回答

Stephen23
Stephen23 2022 年 4 月 13 日
編集済み: Stephen23 2022 年 4 月 13 日
TIMEend = 2029;
fnm = sprintf('Final E monoton %u.fig',TIMEend);
fpt = fullfile('.','PRCC plots for submission 2',fnm);
saveas(figure(1),fpt);

その他の回答 (1 件)

Christopher McCausland
Christopher McCausland 2022 年 4 月 13 日
Hi Sandra,
Yes this is possiable, you can either use strcat() to 'build' the title string first or just use title(), it'll look something like this;
plot(); %whatever you are plotting
hold on;
title('TIMEend =',TIMEend); % Create a string for the title and include the variable value
saveas(figure(1),[pwd '/PRCC plots for submission 2/Final E monoton 2029.fig']) % continue to save...
Let me know if this is what you are looking for,
Christopher

カテゴリ

Help Center および File ExchangeTitle についてさらに検索

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!

Translated by