Char not working properly ?

3 ビュー (過去 30 日間)
Matteo Bonhomme
Matteo Bonhomme 2023 年 1 月 6 日
回答済み: VBBV 2023 年 1 月 9 日
Hello
Acccording to internet the unicode for subscript e ( _{e} in Latex) is U2091 or 8337 in decimal.
char(8337)
ans = 'ₑ'
but on my machine it doesn't work.
Other unicode work but not this one. Does anybody know what I should check ?
I'm on window 11 and my laptop is in french if that helps.
  7 件のコメント
Adam Danz
Adam Danz 2023 年 1 月 9 日
I was able to reproduce these difference between results shown here and on my local machine. Clearly the encoding is not consistent between the Run feature and my local installation and there are differences between recent releases. There were changes to system encoding in 22a (release notes) but that does not explain these differences and I haven't had time to look deeper.
Subscripts codes references on wiki.
unidec = hex2dec({'2090','2099','209c','2091','2099','2099','2090'})
unidec = 7×1
8336 8345 8348 8337 8345 8345 8336
str = ['T', char(unidec')]
str = 'Tₐₙₜₑₙₙₐ'
text(0.5,0.5,str,'FontSize',24)

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

回答 (2 件)

Sulaymon Eshkabilov
Sulaymon Eshkabilov 2023 年 1 月 6 日
To display in a figure is straightforward, e.g.:
figure; title(char(8337))
text(0.5, 0.5, ['This is the character: ' char(8337)])
  3 件のコメント
Matteo Bonhomme
Matteo Bonhomme 2023 年 1 月 9 日
I just did it
I found a workaround so I'll stop looking into this issue but if someone understand what's happening I'm interested

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


VBBV
VBBV 2023 年 1 月 9 日
To display text on figure window, you should rather use uilabel function in place of uitextarea which produces same output as desired, This function also supports both latex and tex interpreters in contrast to former uitextarea function.
hFig=uifigure;
txa = uilabel(hFig);
txa.Text ='T_{antenna}'
txa.Interpreter = 'tex'
txa.FontName= 'Arial';
txa.FontSize=40;
txa.FontWeight='normal'
txa.Position = [100 274 170 45]

カテゴリ

Find more on Dates and Time in Help Center and File Exchange

タグ

製品


リリース

R2021a

Community Treasure Hunt

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

Start Hunting!

Translated by