How to use Greek letters and subscripts in a GUI?

How to use Greek letters and subscripts in a GUI.
Using the code that works for a figure plot doesn't seem to work. I'm using the R2018a version.

 Respuesta aceptada

Cris LaPierre
Cris LaPierre el 21 de Nov. de 2018
Editada: Cris LaPierre el 24 de Nov. de 2018

0 votos

If you are using App Designer, you need to set the interpreter to 'TeX' or 'LaTeX'. Unfortunately, only TickLabelInterpreter is available through the interface. To set other items, you need to do the following:
% For UIAxes Title, XLabel, or YLabel, this can only be accomplished programatically.
% That means you must set the interpreter and string in code - perhaps the startupFcn Callback
app.UIAxes.Title.Interpreter = 'latex';
app.UIAxes.Title.String = '$\int_{0}^{2} x^3\sin(x) dx$';
% For text objects:
text(app.UIAxes,0.5,0.5,'$\int_{0}^{2} x^3\sin(x) dx$','Interpreter','latex');
% For colorbar:
c = colorbar(app.UIAxes);
c.Label.Interpreter = 'latex';
c.Label.String = '$\int_{0}^{2} x^3\sin(x) dx$';
% For legend:
h = legend(app.UIAxes);
title(h,'$\int_{0}^{2} x^3\sin(x) dx$','Interpreter','latex');
All other components do not yet support interpreters (in 2018a).

Más respuestas (0)

Categorías

Más información sobre Labels and Annotations en Centro de ayuda y File Exchange.

Etiquetas

Preguntada:

el 21 de Nov. de 2018

Editada:

el 24 de Nov. de 2018

Community Treasure Hunt

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

Start Hunting!

Translated by