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!