Write sigma in uicontrol / text

19 visualizzazioni (ultimi 30 giorni)
Zsolt Lord
Zsolt Lord il 24 Mag 2013
Commentato: Image Analyst il 11 Dic 2020
Right now, I'm trying to make a GUI, which calculates a certain sum, and I'd like to write a sigma sign, but for some reason, it's not working.
This is what I tried: uicontrol ('Style','text',... 'String','\sigma_1',... 'FontSize',25,... 'Position', [200 340 100 50]);
If I try copy-pasting a sigma sign off google, it just turns into a '?'.

Risposta accettata

Sean de Wolski
Sean de Wolski il 24 Mag 2013
Use an annotation instead of a uicontrol. This offers a text interpreter property:
annotation(gcf,'textbox','String','\sigma_1', 'FontSize',25,'units','pix', 'Position', [200 340 100 50],'Interpreter','Tex');
  3 Commenti
patrick mumba
patrick mumba il 18 Mag 2016
please share how you did it
Image Analyst
Image Analyst il 18 Mag 2016
Capitalize sigma:
annotation(gcf,'textbox','String','\Sigma_1', 'FontSize',25,'units','pix', 'Position', [200 340 100 50],'Interpreter','Tex');

Accedi per commentare.

Più risposte (2)

Image Analyst
Image Analyst il 24 Mag 2013

laurent jalabert
laurent jalabert il 11 Dic 2020
Modificato: laurent jalabert il 11 Dic 2020
For displaying \Theta in a gui
for Style text :
GE = char(hex2dec('03B8')); test = uicontrol('Style','text','String', GE)
For Style list :
GE = char(hex2dec('03B8')); test = uicontrol('Style','list','String', GE)
This is working.
Now, I am using PLOT with ylabel. Those ylabel contains greek characters, displayed correctly since Interpreter Tex is OK.
how can I display an array if ylabell{:} as a Style list in the uicontrol ?
I give an example :
ylabell{1}=('\Theta'); ylabell{2}='\Ree T_i*\gamma [C]' ;
test = uicontrol('Style','list','Position',[100 100 200 100],'FontSize',14,'max',10,...
'min',1,'String', ylabell)
The problem is that Interpreter Tex is not a uicontrol class property. So it is impossible to have the same rendering of the greek character in uicontrol such as in ylabl axis of the graph.
So how to solve this problem when the Style list contains 80 different items containing greek characters ?
If I have to convert each greek character using char(hex2dec(' 03B8')), it is a bit fastidious isn't it ?
Strangely, a possible answer is to copy paste Δ instead of \Delta ... and it works both for ylabel and uicontrol list ...

Categorie

Scopri di più su Labels and Annotations in Help Center e File Exchange

Community Treasure Hunt

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

Start Hunting!

Translated by