plotting with Displayname in a for loop

11 ビュー (過去 30 日間)
Tim Deutman
Tim Deutman 2023 年 5 月 15 日
編集済み: dpb 2023 年 5 月 15 日
this is my code. U_sin_2D is a function that I would like to plot for every t. But it gives me an error if i put 't = ' before string(t). It does not give me an error if i only do string(t). I would like to add 't = ' before every corresponding t in the legend. How would i do this?

採用された回答

dpb
dpb 2023 年 5 月 15 日
編集済み: dpb 2023 年 5 月 15 日
Don't use images for code; paste the text and format with the "Code" section...nothing can do with an image but look at it...
Use
...,'DisplayName',"t = "+t)
to use the builtin overloaded plus operator for string class. Or, explicitly catenate the two strings into the one; you have two separate strings as the argument property as written above, not one.
  1 件のコメント
Tim Deutman
Tim Deutman 2023 年 5 月 15 日
Thank you!

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

その他の回答 (0 件)

カテゴリ

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

製品


リリース

R2021b

Community Treasure Hunt

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

Start Hunting!

Translated by