LaTex for Titles in Appdesigner now possible?

15 vues (au cours des 30 derniers jours)
Niklas Kurz
Niklas Kurz le 24 Fév 2022
Commenté : Cris LaPierre le 25 Fév 2022
I'm now finding into appdesigner myself and have saw multiple people asking how to incorporate LaTex.
There are some workaround like
text(app.UIAxes,200,1.2,'Plot of','Interpreter','latex')
but using this as title is hard to align so I strive for an inbuilt adaption, resolving this issue.
Also, I want to update the title dependent on user input. How am I supposed to do that? The plain solution I've found is by:
app.UIAxes.Title.String = "Plot of "+ double(app.CEditField.Value) + "*sin(" + double(app.mEditField.Value) + "*x)"
Can't it be shorter? Also it lacks the primordial desire to choose LaTex interpreter.

Réponse acceptée

Cris LaPierre
Cris LaPierre le 24 Fév 2022
The easiest way to set the interpreter to LaTeX for a title is to use the 'interpreter' name-value pair.
title(app.UIAxes,'title string','Interpreter','latex')
However, there is no LaTeX markup in your title string, so it will still just display as text. What is the LaTeX expression you are wanting to create?
  4 commentaires
Niklas Kurz
Niklas Kurz le 25 Fév 2022
Modifié(e) : Niklas Kurz le 25 Fév 2022
I've accepted this answere even though
C = app.CEditField.Value
m = app.mEditField.Value
are not updated when choosing different values in the Edit Field.
I tried using
title(app.UIAxes,'$$C\,\sin(m\,x)$$','Interpreter','latex')
%and
title(app.UIAxes,'$C\,\sin(m\,x)$','Interpreter','latex')
but no big difference there. C and m are displayed as text and not their Value.
Cris LaPierre
Cris LaPierre le 25 Fév 2022
Vaules displayed in purple are text and not variables. You need to do something like what you were doing before if you want to use the values of C and m and not the letters C and m.
I might write my callback functions for each edit field like this.
% Value changed function: mEditField
function mEditFieldValueChanged(app, event)
C = app.CEditField.Value;
m = app.mEditField.Value;
title(app.UIAxes,"Plot of $"+ C + "*\sin(" + m + "*x)$",'Interpreter','latex')
end
% Value changed function: CEditField
function CEditFieldValueChanged(app, event)
C = app.CEditField.Value;
m = app.mEditField.Value;
title(app.UIAxes,"Plot of $"+ C + "*\sin(" + m + "*x)$",'Interpreter','latex')
end

Connectez-vous pour commenter.

Plus de réponses (0)

Catégories

En savoir plus sur Specifying Target for Graphics Output dans Help Center et File Exchange

Community Treasure Hunt

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

Start Hunting!

Translated by