LaTex for Titles in Appdesigner now possible?

조회 수: 16 (최근 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 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