Borrar filtros
Borrar filtros

How to write Latex in GUI's label?

40 visualizaciones (últimos 30 días)
Zihao Liu
Zihao Liu el 25 de En. de 2021
Editada: Adam Danz el 11 de Feb. de 2021
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 comentarios
dpb
dpb el 25 de En. de 2021
The 'interpreter' property doesn't appear to exist so looks like can't be done.
Adam Danz
Adam Danz el 25 de En. de 2021
In 2020b it doesn't exist from the design view options but the property does exist and is editable from the code.

Iniciar sesión para comentar.

Respuestas (1)

Adam Danz
Adam Danz el 25 de En. de 2021
Editada: Adam Danz el 25 de En. de 2021
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 comentarios
Zihao Liu
Zihao Liu el 11 de Feb. de 2021
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 el 11 de Feb. de 2021
Editada: Adam Danz el 11 de Feb. de 2021
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.

Iniciar sesión para comentar.

Categorías

Más información sobre Startup and Shutdown en Help Center y File Exchange.

Community Treasure Hunt

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

Start Hunting!

Translated by