How can i get latex symbols in my figure title with the use of variables?

36 ビュー (過去 30 日間)
Thys Scholten
Thys Scholten 2019 年 11 月 22 日
編集済み: Ruger28 2019 年 11 月 22 日
Im am trying to plot some figure but have trouble with the title. The title must have some variables which change over the loop for which i use the num2str command. I do however want some Latex tekst to indicate the variables. Somehow this does not work.
My code is:
naam = ['Comparison of DSDS with measured data. ','\Beta = ' num2str(Beta(idx(1,1),1)),' ' 'L_p/B_{px} =' num2str(LpBpx(idx(1,1),1)),' ' 'A_p/\nabla =' , num2str(ApNabla(idx(1,1),1)) ,' ' 'LCG =' , num2str(LCG(idx(1,1),1))];
title(naam,'Interpreter', 'tex')
The title then returns as:
untitled.jpg
In my labels and in my legend the latex tekst does work properly.
Can someone help me with what I am doing wrong?

採用された回答

Ruger28
Ruger28 2019 年 11 月 22 日
編集済み: Ruger28 2019 年 11 月 22 日
I dont have all of your variables, but I personally like sprintf. I would strcat your title using strcat to bring it all together. Just ensure the '\beta' is outside of the sprintf.
also it is '\beta' not '\Beta'. This is most likely your issue.
i = 2;
naam = strcat(sprintf('Test Title = %i', i),'\beta');
title(naam,'Interpreter','tex');

その他の回答 (0 件)

カテゴリ

Help Center および File ExchangeCharacters and Strings についてさらに検索

製品


リリース

R2017a

Community Treasure Hunt

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

Start Hunting!

Translated by