Borrar filtros
Borrar filtros

Write sigma in uicontrol / text

27 visualizaciones (últimos 30 días)
Zsolt Lord
Zsolt Lord el 24 de Mayo de 2013
Comentada: Image Analyst el 11 de Dic. de 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 '?'.

Respuesta aceptada

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

Iniciar sesión para comentar.

Más respuestas (2)

Image Analyst
Image Analyst el 24 de Mayo de 2013

laurent jalabert
laurent jalabert el 11 de Dic. de 2020
Editada: laurent jalabert el 11 de Dic. de 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 ...

Categorías

Más información sobre Labels and Annotations en Help Center y File Exchange.

Community Treasure Hunt

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

Start Hunting!

Translated by