variable value in figure title with separate lines

2 ビュー (過去 30 日間)
Hannah Sargeant
Hannah Sargeant 2017 年 3 月 7 日
コメント済み: Hannah Sargeant 2017 年 3 月 10 日
I am trying to change the title of a figue dependent on an input value. However, my title is on multiple lines as it is so long. Therefore I can't use the standard format for adding a variable to a title.
The code I am using for the title name is below, and the variable is H2_conc:
title({'How Knudsen number changes for differing','ilmenite concentrations throughout the reaction','with a Hydrogen to ilmenite ratio of' num2str(H2_conc)':1' })

採用された回答

Jose Lara
Jose Lara 2017 年 3 月 9 日
編集済み: Jose Lara 2017 年 3 月 9 日
Hi Hannah,
You need to concatenate the string for the second line. It should look like shown below:
title({'How Knudsen number changes for differing ilmenite concentrations throughout the reaction ',...
['with a Hydrogen to ilmenite ratio of ' num2str(H2_conc) ' :1' ]})
Notice that after the comma, I used square brackets to enclose three different strings to create one complete string. Also, notice that I added "..." at the end of the first line. The tree dots means line continuation. MATLAB expressions normally end at the end of the line and adding these dots continue the "title" function.
  1 件のコメント
Hannah Sargeant
Hannah Sargeant 2017 年 3 月 10 日
That's great, thank you! I used my original code with the square brackets which allows me to have three separate lines without the need to uses the ...

サインインしてコメントする。

その他の回答 (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