How to simply output LaTeX in MatLab app designer?
14 Ansichten (letzte 30 Tage)
Ältere Kommentare anzeigen
Tyuser
am 8 Apr. 2021
Beantwortet: Monisha Nalluru
am 14 Apr. 2021
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.
0 Kommentare
Akzeptierte Antwort
Monisha Nalluru
am 14 Apr. 2021
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>ε</html>')
uilabel support LaTex using Interpreter option. So using grid layout with uilabel in app designer you can achieve a similar look.
0 Kommentare
Weitere Antworten (0)
Siehe auch
Kategorien
Mehr zu Develop Apps Using App Designer finden Sie in Help Center und File Exchange
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!