How can I make the labels of components in appdesigner use the latex interpreter?
古いコメントを表示
Hi,
Is there a way to make the label of a numeric box in a GUI generated by appdesigner to use latex as an interpreter? Currently, if I want to say label the numeric text box it displays e.g. y_2(0). How can I make it display $y_2(0)$ i.e. in latex mode, please?
Thank you!
3 件のコメント
Christopher Braunholz
2018 年 8 月 9 日
移動済み: Voss
2024 年 10 月 4 日
This is not satisfying, Matlab.
André Luis Gama Rodrigues
2018 年 8 月 22 日
移動済み: Voss
2024 年 10 月 4 日
Yeah, App Designer still lacks a ton of features which we have to work around. I'm also quite disappointed with it.
Julio Perez
2022 年 7 月 3 日
移動済み: Voss
2024 年 10 月 4 日
en 2022 sigue los mismos limitantes que terrible
採用された回答
その他の回答 (2 件)
Rick Butler
2019 年 7 月 21 日
編集済み: Rick Butler
2019 年 7 月 21 日
As a workaround I sometimes use a figure instead with the following properties:
- No labels, title, ticks or ticklabels
- YLim = [0,1], XLim depends on the width of your 'label'
- XColor, YColor and the color of the box set to 'none'
- DataAspectRatio = [1,1,1]
Now you can use
text(figure_handle, 0.2, 0.5, '$L\alpha TeX t\epsilon xt$', 'Interpreter', 'latex', more options..)
Copy-pasting from another source is probably less tedious but this solution allows you to change your label text dynamically.
Fingers crossed for label interpreters in 2019b!
3 件のコメント
Ron Fredericks
2020 年 3 月 24 日
編集済み: Ron Fredericks
2020 年 3 月 24 日
Rick's answer worked well for me using R2019b!
Code Snippet:
% Initialize LateX equation
csign = ['+' '-']; % manage sign of c value in LateX equation
csign_idx = 1;
if c>=0
csign_idx = 2;
end
title(app.UIAxes, ...
['$$ f_ (x) = \frac{\mathrm{' num2str(round(a,2)) ...
'} }{\mathrm{1} + e^{-' num2str(round(b,2)) ...
'(x' csign(csign_idx) num2str(round(abs(c),2)) ...
')} } $$'],"Interpreter","latex")
axis(app.UIAxes,'off')
Result shown in upper right hand of my GUI:

Saeid
2021 年 7 月 26 日
Nice example, Ron. It covers almost all the cases that someone needs to put a formula into a GUI!
Thanks!
Gary Gorman
2022 年 12 月 29 日
I am trying to get Rick's and ron's methods to work but no luck. As for Rick's method:
figure_handle = gcf; text(figure_handle, 0.2, 0.5, '$L\alpha TeX t\epsilon xt$', 'Interpreter', 'latex', more options..)
throws and error "Error using text Text cannot be a child of Figure."
Ron's answer throws a bunch of errors, probably because either 1) I do not understand how to fill in the missing but presumed user-understood syntax items, or 2) Ron's example code is not executable in a standard livescript; Ron's code only executes in AppDesigner.
Does there exist anywhere a code example for a .mlx file which contains all the necessary commands and sytax to run?
Jasmine Poppick
2024 年 10 月 4 日
2 投票
Starting in R2021a, you can set the Interpreter property of a label to "latex" to display equations. For more info, see Label.
カテゴリ
ヘルプ センター および File Exchange で App Building についてさらに検索
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!