How do I format this title function?

12 ビュー (過去 30 日間)
Kavorka
Kavorka 2016 年 2 月 14 日
回答済み: Star Strider 2016 年 2 月 14 日
I'm displaying a figure and I want its title to be a file name as well as a string of text in combination. If the file name was Filename == example.tif and the text was '-ER' I'd want the figure title to be example.tif-ER
Doing this doesn't seem to work:
title(Filename '-ER')
I get an error in return, do I need to put something in between Filename and '-ER' to show I want them one after another as the title?

採用された回答

Star Strider
Star Strider 2016 年 2 月 14 日
Use the sprintf function:
filename = 'example.tif';
plot( ... )
title(sprintf('%s-ER', filename))

その他の回答 (0 件)

カテゴリ

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