How to simply output LaTeX in MatLab app designer?

14 ビュー (過去 30 日間)
Tyuser
Tyuser 2021 年 4 月 8 日
回答済み: Monisha Nalluru 2021 年 4 月 14 日
I am pretty new to App designer. I couldn't find an answer to this question. I want to output a LaTeX matrix in app designer but not in an UIAxes just simply somehow in UIFigure. I tried to use table:
Out = [symtext1 number1 symtext4; symtext2 number2 symtext5; symtext3 number3 symtext6];
latex_Out = latex(str2sym(Out));
app.OutputTable.Data = latex_Out;
but this only gets me a table with an error:
"Error setting property 'Data' of class 'Table':
Data must be a numeric, logical, string, cell, or table array"
or a table full of [1x1 sym] (depends on if I use str2sym or sym).
I also tried to display it in a layout grid with :
GridLayout = uigridlayout(Panel);
GridLayout.ColumnWidth = {'1x', '1x', '1x'};
GridLayout.RowHeight = {'1x', '1x', '1x'};
for i = 1:3
for j = 1:3
Output = uilabel(GridLayout,"Text",Out(i,j))
Output.Layout.Row = i;
Output.Layout.Column = j;
end
end
but this didn't work. It got me this error:
"Error using sym>convertChar (line 1557)
Character vectors and strings in the first argument can only specify a variable or number. To evaluate character vectors and strings representing symbolic expressions, use 'str2sym'.
Error in sym>tomupad (line 1273)
S = convertChar(x);
Error in sym (line 229)
S.s = tomupad(x);
Error in cell2sym (line 31)
Csym = cellfun(conv, C, 'UniformOutput', false);
Error in sym>tomupad (line 1285)
xsym = cell2sym(x);
Error in sym (line 229)
S.s = tomupad(x);"
and with converting Out to sym [sym(Out)]: "Error using uilabel (line 36)
'Text' must be a character vector, or a 1-D array of the following type: cell array of character vectors, string, or categorical."
Am I doing something simple wrong? Is there a way to display a LaTeX matrix or LaTeX text in UI figure or its components? I also tried to use pretty much every ___2sym conversion within the matrix to get the LaTeX output displayed on screen but nothing worked.

採用された回答

Monisha Nalluru
Monisha Nalluru 2021 年 4 月 14 日
LaTex is not supported in uitable. I have brought this issue to the concerned people and it might be considered in any future release.
However, if you just want to interpret some unicode characters instead of complicated formulas, you can use HTML hexadecimal reference to do it . Please see the example below.
%This will show the Greek character "epsilon"
t=uitable('RowName','<html>&#x03B5</html>')
uilabel support LaTex using Interpreter option. So using grid layout with uilabel in app designer you can achieve a similar look.

その他の回答 (0 件)

カテゴリ

Help Center および File ExchangeLaTeX についてさらに検索

製品


リリース

R2020b

Community Treasure Hunt

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

Start Hunting!

Translated by