How to write Latex in GUI's label?

조회 수: 19 (최근 30일)
Zihao Liu
Zihao Liu 2021년 1월 25일
편집: Adam Danz 2021년 2월 11일
I want to write latex in Matlab's GUI labels. For example:
I have tried \theta, and with $ on both sides, but it does not work. Could someone please tell me how to solve this question? Thanks.
  댓글 수: 2
dpb
dpb 2021년 1월 25일
The 'interpreter' property doesn't appear to exist so looks like can't be done.
Adam Danz
Adam Danz 2021년 1월 25일
In 2020b it doesn't exist from the design view options but the property does exist and is editable from the code.

댓글을 달려면 로그인하십시오.

답변 (1개)

Adam Danz
Adam Danz 2021년 1월 25일
편집: Adam Danz 2021년 1월 25일
From the startup function of your app, set the Edit Field Label's interpreter property to latex. You may need to reassign the string too.
function startupFcn(app)
app.thetaPoint1EditFieldLabel.Interpreter = 'latex';
app.thetaPoint1EditFieldLabel.Text = '$\theta$ of point';
end
Result:
  댓글 수: 4
Zihao Liu
Zihao Liu 2021년 2월 11일
Hi Adam, I tried using your instructions but Matlab returned an error saying that there is no property called 'interpreter'. The Matlab version I am using is R2019b and could you please tell me what I should do to fix this? Thanks
Adam Danz
Adam Danz 2021년 2월 11일
편집: Adam Danz 2021년 2월 11일
App designer gets more support and features with every new release since it became available. I don't know when the interpreter property was first supported for this object but I do know it works in r2020b and the result is shown in my answer. You could update to r2020b. Otherwise, there is no solution I'm aware of.

댓글을 달려면 로그인하십시오.

카테고리

Help CenterFile Exchange에서 Startup and Shutdown에 대해 자세히 알아보기

Community Treasure Hunt

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

Start Hunting!

Translated by