LaTex for Titles in Appdesigner now possible?

17 ビュー (過去 30 日間)
Niklas Kurz
Niklas Kurz 2022 年 2 月 24 日
コメント済み: Cris LaPierre 2022 年 2 月 25 日
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 Center および File ExchangeSpecifying 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