LaTex for Titles in Appdesigner now possible?

17 次查看(过去 30 天)
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.

采纳的回答

Cris LaPierre
Cris LaPierre 2022-2-24
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 个评论
Niklas Kurz
Niklas Kurz 2022-2-25
编辑:Niklas Kurz 2022-2-25
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 2022-2-25
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

请先登录,再进行评论。

更多回答(0 个)

类别

Help CenterFile Exchange 中查找有关 Specifying Target for Graphics Output 的更多信息

标签

Community Treasure Hunt

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

Start Hunting!

Translated by