Write sigma in uicontrol / text

23 Ansichten (letzte 30 Tage)
Zsolt Lord
Zsolt Lord am 24 Mai 2013
Kommentiert: Image Analyst am 11 Dez. 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 '?'.

Akzeptierte Antwort

Sean de Wolski
Sean de Wolski am 24 Mai 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 Kommentare
patrick mumba
patrick mumba am 18 Mai 2016
please share how you did it
Image Analyst
Image Analyst am 18 Mai 2016
Capitalize sigma:
annotation(gcf,'textbox','String','\Sigma_1', 'FontSize',25,'units','pix', 'Position', [200 340 100 50],'Interpreter','Tex');

Melden Sie sich an, um zu kommentieren.

Weitere Antworten (2)

Image Analyst
Image Analyst am 24 Mai 2013

laurent jalabert
laurent jalabert am 11 Dez. 2020
Bearbeitet: laurent jalabert am 11 Dez. 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 ...

Kategorien

Mehr zu Labels and Annotations 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!

Translated by