uitable with latex or greek letters

31 ビュー (過去 30 日間)
Deividas Eringis
Deividas Eringis 2021 年 8 月 9 日
コメント済み: Assaf 2024 年 7 月 16 日
I am working in App Designer,
i want to create a table with 2 collumns where first collumn is a parameter name, something like "$\gamma^a_b$"
and second collumn would be numeric and editable.
It seems like neither UITable or UIStyle have latex interpreter,
i have seen answers from 2016 with unicode characters and html tags, but either i'm doing something wrong or they do not work anymore.
app.AllParamTable = uitable(app.AllParamPanel);
app.AllParamTable.ColumnName = {'Parameter'; 'Value'};
app.AllParamTable.ColumnEditable = [false true];
parDisp={'\alpha_1','V^G_C'};
params={'alpha1','VGC'};
for i=1:numel(params)
app.AllParamTable.Data{i,1}=parDisp{i};
app.AllParamTable.Data{i,2}=app.p.Param.(params); %app.p.Param is a struct, and will always return numeric.
end

採用された回答

Dave B
Dave B 2021 年 8 月 9 日
編集済み: Eric Sargent 2023 年 10 月 12 日
Starting in R2022a, the Interpreter property is supported in uistyle.
Previous answer (Aug 9, 2021)
I believe html tags are not currently supported in uitable when in a uifigure (i.e. created in App Designer)
However the greek letter part is a little easier, you can use unicode for this (char(945), or just use an α in your code):
u = uitable(uifigure);
u.Data{1}=char(945); % or u.Data{1}='α';
  3 件のコメント
Deividas Eringis
Deividas Eringis 2021 年 8 月 9 日
great that solves part of my issue,
if html tags are not supported are there any other ways to use subscripts/superscripts?
Dave B
Dave B 2021 年 8 月 9 日
I don't have a good solution for superscript/subscript. This is really out of the box and I realize far from ideal:
  • You can sort of fake a superscript g (but not G) with unicode: char(7586)
  • There's no subscript for c or C but there is a gamma: char(7527)
uitable(uifigure,'data',{['V' 7586 7527]})

サインインしてコメントする。

その他の回答 (2 件)

Sean de Wolski
Sean de Wolski 2021 年 8 月 9 日
You could use a uihtml component with an embedded table. Of course this table will not be interactive, but if it's for display only then it would work.

Amanda Irving
Amanda Irving 2023 年 10 月 12 日
Starting in R2022a, Interpreter is supported in uistyle:
https://www.mathworks.com/help/matlab/ref/uistyle.html
  1 件のコメント
Assaf
Assaf 2024 年 7 月 16 日
Hi,
I still didn't manage to use it for column names, do anyone has solution for it?
Thanks

サインインしてコメントする。

カテゴリ

Help Center および File ExchangeEnvironment and Settings についてさらに検索

製品


リリース

R2020b

Community Treasure Hunt

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

Start Hunting!

Translated by