フィルターのクリア

Helping adding Tittle to Plot (multititle)

2 ビュー (過去 30 日間)
Peter
Peter 2015 年 1 月 5 日
編集済み: UCRMechanicalEngineer 2016 年 6 月 29 日
Hello,
I have a contour plot and i need a title like that for it:
"my title" variable1 variable2
My title is a character string always the same, but variable1 and variable2 change with every plot.
I have tried this:
title('my title', variable1, variable2);
But it did not work.
Error in ==> title at 55
set(h, 'String', string, pvpairs{:});
I also want to add units to the colourbar and a legend
Thank you very much!

採用された回答

Star Strider
Star Strider 2015 年 1 月 5 日
If ‘variable1’ and ‘variable2’ are strings, this works:
variable1 = 'Velocity';
variable2 = 'Position';
figure(1)
scatter(rand(10,1), rand(10,1), 'bp')
title(sprintf('“My Title“ %s %s', variable1, variable2))
  10 件のコメント
Star Strider
Star Strider 2015 年 1 月 5 日
My pleasure!
UCRMechanicalEngineer
UCRMechanicalEngineer 2016 年 6 月 29 日
編集済み: UCRMechanicalEngineer 2016 年 6 月 29 日
Thank you, this helped me.

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

その他の回答 (1 件)

Julian Hapke
Julian Hapke 2015 年 1 月 5 日
title(['my title' var1 var2])
depending on the variable type, you may have to convert to string and add separators like whitespace when concatenating.
  1 件のコメント
Peter
Peter 2015 年 1 月 5 日
adding separators like whitespace does not work, the variables appears together

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

カテゴリ

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