Trying to get symbols to display a formula in title of uiaxes bar plot
1 回表示 (過去 30 日間)
古いコメントを表示
Govind Sankar Madhavan Pillai Ramachandran Nair
2025 年 6 月 26 日
回答済み: Govind Sankar Madhavan Pillai Ramachandran Nair
2025 年 6 月 26 日
I am trying to get symbols to display a formula in title of uiaxes bar plot. In the beginning it was like this. I enter this code :
app.UIAxes_4.Title.String = 'Sigma of each cell, $$\sigma = \sqrt{1/N*\Sigma_N(E-R_{ref})^2}$$'
and then I got this.

This is correct. But I want to add this along with it

This is from another normal plot and i generated this by using the code :
titl1 ='best \sigma = ';
titl2 = num2str(app.bestSigma);
titl3 = ' worst \sigma= ';
titl4 = num2str(app.worstSigma);
titl = strcat(titl1,titl2,titl3,titl4);
app.UIAxes_3.Title.String = titl;
And now I try to combine this :
titl1 ='Sigma of each cell, $$\sigma = \sqrt{1/N*\Sigma_N(E-R_{ref})^2}$$, best \sigma = ';
titl2 = num2str(app.bestSigma);
titl3 = ' worst \sigma= ';
titl4 = num2str(app.worstSigma);
titl = strcat(titl1,titl2,titl3,titl4);
app.UIAxes_4.Title.String = titl;
But I end up getting this :

I even tried this :
app.UIAxes_4.Title.String = "Sigma of each cell, $$\sigma = \sqrt{1/N*\Sigma_N(E-R_{ref})^2}$$, best \sigma = " + num2str(app.bestSigma) + " worst \sigma= " + num2str(app.worstSigma);
and still ended up getting the same wrong answer.
So how can I combine the first two images to get the solutioin for a title in an UIaxes bar plot. Thank you.
1 件のコメント
Epsilon
2025 年 6 月 26 日
編集済み: Epsilon
2025 年 6 月 26 日
Try:
titl = sprintf(['Sigma of each cell, $$\\sigma = \\sqrt{\\frac{1}{N}\\sum_N(E-R_{ref})^2}$$, ', ...
'best $\\sigma = %.3f$, worst $\\sigma = %.3f$'], ...
app.bestSigma, app.worstSigma);
app.UIAxes_4.Title.String = titl;
app.UIAxes_4.Title.Interpreter = 'latex';
回答 (1 件)
参考
カテゴリ
Help Center および File Exchange で Title についてさらに検索
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!